How to Install vsftpd Server on CentOS / RHEL

How to Install vsftpd Server on CentOS / RHEL

What is vsftpd? vsftpd (very secure FTP daemon) is an FTP server for Unix-like systems. vsftpd is the default FTP server in the Ubuntu, CentOS, Fedora, RHEL Linux distributions.

 

Step One – Update your Linux System and Install vsftpd server on CentOS

# yum update
# yum install vsftpd ftp

 

Step Two – Configure vsftpd

Before changing configuration backup your vsftpd.conf file:

# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.backup

Then open vsftpd config file vsftpd.conf and change default settings:

# vi /etc/vsftpd/vsftpd.conf

anonymous_enable=NO #Disallow anonymous FTP
local_enable=YES #allow local users to log in
chroot_local_user=YES #local users will be denied access to any other part of the server

 

For security reasons you can also set:

connect_from_port_20=NO

This option allows vsftpd to run with less privileges, but may be incompatible with some FTP clients.

More information about vsftpd conf you can found in man pages:

# man vsftpd.conf

Now for loading new configuration restart vsftpd service:

# service vsftpd restart

 

Enable vsftpd start on boot:

# chkconfig vsftpd on

 

Add new FTP user

Create home directory for new user, create new user – ftpuser, and disable SSH access:

# useradd -d /home/PathToYourDirectory -s /sbin/nologin ftpuser

 

Setup password for new user:

# passwd ftpuser

 

Change permissions and the ownership for directory:

# chown -R ftpuser /home/PathToYourDirectory
# chmod 755 /home/PathToYourDirectory

 

Now we can test local connection with our new installed FTP server:

Sample output:
# ftp localhost
Connected to 127.0.0.1 (127.0.0.1).
220 (vsFTPd 2.2.2)
Name (127.0.0.1:root): ftpuser
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

 

Finaly, after vsftpd setup do not forget configure the firewall for and open port TCP 21.

Also you may need to disable SELinux.

 

arstech

Leave a Reply

Your email address will not be published. Required fields are marked *