Install vsftpd
Before installing new software, itâs always best practice to run updates:
yum -y update
Then install vsftpd and any required packages:
yum -y install vsftpd
Configure vsftpd
For a refresher on editing files with vim see: New User Tutorial: Overview of the Vim Text Editor
Edit vsftp Configurations
Now letâs edit the configuration file for vsftpd. Open the file with the following command:
vim /etc/vsftpd/vsftpd.conf
Now that the file is opened up youâll want to make the following changes. Either find the option line and edit it, or simply delete it and replace with the lines noted here.
Disallow anonymous logins; this allows unidentified users to access files via FTP. Ensure that the anonymous_enable setting to NO:
anonymous_enable=NO
Enable local users to login, this will allow your regular user accounts to function as FTP accounts. Change the local_enable setting to YES:
local_enable=YES
If you want local user to be able to write to a directory, then change the write_enable setting to YES:
write_enable=YES
Local users will be âchroot jailedâ and they will be denied access to any other part of the server. Set the chroot_local_user setting to YES:
chroot_local_user=YES
Exit and save the file with the command :wq
, or with :x
.
Restart and Enable the vsftpd service:
First restart the service:
systemctl restart vsftpd
Then set the vsftpd service to start at boot:
systemctl enable vsftpd
Allow vsftpd Through the Firewall
Allow the default FTP port, port 21, through firewalld:
firewall-cmd --permanent --add-port=21/tcp
And reload the firewall:
firewall-cmd --reload
And that is it! You should now have vsftpd installed, setup and configured on your server. If you followed these directions you should now be able to login to the server via FTP! If you have a hardware firewall in addition to the servers software firewall, you may need to adjust those setting too.