[How-To] Install FTP Server on Fedora

The FTP (File Transfer Protocol) is used as one of the most common means of copying files between servers over the Internet, in this post we will get in touch on how to install/configure FTP on Fedora.

This tutorial can be work on the most Linux Distributions (Fedora, Debian, Ubuntu, CentOS… just some commands have to be changed).

Befora anything, make sure that your system is up to date.

# yum update -y

Installing VSFTPD

To install VSFTPD (Very Secure FTP Daemon):

# yum install -y vsftpd
  • Starting the service:
# systemctl start vsftpd.service
  • Configuring VSFTPD:

VSFTPD reads the contents of its vsftpd.conf configuration file only when it starts, so you’ll have to restart VSFTPD each time you edit the config file in order for the changes to take effect. The file be located in the /etc/vsftpd directory, just edit it, each config has a comment and it explains itself 🙂

# vi /etc/vsftpd/vsftpd.conf
...
# Disable anonymous FTP
anonymous_enable=NO

# Enable individual logins
local_enable=YES
...
write_enable=NO
dirmessage_enable=YES
dirlist_enable=YES
...
file_open_mode=0777
ftpd_banner= Welcome to my FTP Server
...

# systemctl restart vsftpd.service
  • Create a user group and shared directory:

Each user want to use FTP must be in the ftp-users group

# groupadd ftp-users
# mkdir /home/ftp-docs
  • Make the directory accessible to the ftp-users group:
# chmod 750 /home/ftp-docs
# chown root:ftp-users /home/ftp-docs
  • Add users, and make their default directory /home/ftp-docs:
# useradd -g ftp-users -d /home/ftp-docs user1
# passwd user1
  • Copy the shared files into the /home/ftp-docs directory
# useradd -g ftp-users -d /home/ftp-docs user1
# passwd user1
  • Change the permissions:

Make all files in the /home/ftp-docs directory to read only access by the group
Now, users should be able to log in via FTP to the server…

$ ftp 192.168.1.1
Connected to 192.168.1.1 (192.168.1.1).
220 Welcome to my FTP Server.
Name (192.168.1.1:boubakr): user1
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/home/ftp-docs"
ftp> ls -l
227 Entering Passive Mode (127,0,0,1,114,210).
150 Here comes the directory listing.
-rwxr-----    1 0        1002            0 Dec 29 16:53 file
226 Directory send OK.
ftp> quit
221 Goodbye.
$

As expected, anonymous FTP fails (you can’t allow them by modifing the vsftpd.conf):

$ ftp 192.168.1.1
Connected to 192.168.1.1 (192.168.1.1).
220 Welcome to my FTP Server.
Name (192.168.1.1:boubakr): anonymous
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
ftp> quit
221 Goodbye.
$

FTP is a very useful software application, in this post we used a basic configuration, however you can make better.

Advertisements

Tagged: , , , , , ,

Leave a Reply :

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: