How to Set Up VSFTPD on CentOS 7.x?

VSFTPD (Very Secure FTP Daemon) is an FTP server for Unix/ Linux systems. It is a default FTP server on CentOS, RHEL Linux distributions, and other Linux OS; it also supports IPv6, TLS, and FTPS. 

Please refer to the following steps to install VSFTPD on CentOS 7.x. 

1. Log in to your Linux server using SSH with root or sudo user.

2. Let us run the update before we proceed with the installation.

yum -y update

3. Install the VSFTPD using this command –  

yum -y install vsftpd

We will edit the VSFTPD setup to configure it.

4. Open the vsftpd.conf located at /etc/vsftpd/ directory.
    You can use your preferred editor for this. 

vim /etc/vsftpd/vsftpd.conf

Once the file is open, we need to make the changes given below.

5. Disable the anonymous logins.
This will prevent unidentified users from accessing files via FTP.

Set the anonymous_enable to NO.

anonymous_enable=NO

6. Allow login for local users.
It enables your local user accounts to function as FTP accounts.

Set local_enable to YES

local_enable=YES

7. If you want to allow your local user to write to a directory, set the write_enable to YES.

write_enable=YES

8. We need to set chroot_local_user to yes.
    This option will deny your local users access to the other part of the server.

Set the chroot_local_user to YES.

chroot_local_user=YES

9. Save all the changes and exit from the file.

10. Now, we will enable and restart the VSFTP service. 

systemctl enable vsftpd
systemctl restart vsftpd

You need to allow port 21 for VSFTP in the Linux firewall.
Please refer to How to Allow a Port in a Linux Firewall?

Now, we will create a user account and configure it to connect with FTP.

1. Add a user with this command – 

useradd demovps

2. Set the password for the created user with the below-given command – 

passwd demovps

3. Add the user to the VSFTP user list.

echo “demovps” | sudo tee –a /etc/vsftpd/user_list

4. Let us set the proper permission for the user folder.

sudo chmod 750 /home/demovps/
sudo chown -R demovps: /home/demovps/



Was this answer helpful?

« Back

chat