First, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new.
Then let’s install vsftpd and any required packages:
apt-get -y install vsftpd
Let’s edit the configuration file for vsftpd:
Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to NO:
Allow local uses to login by changing the local_enable setting to YES:
If you want local user to be able to write to a directory, then change the write_enable setting to YES:
Local users will be ‘chroot jailed’ and they will be denied access to any other part of the server; change the chroot_local_user setting to YES:
Exit and save the file.
Restart the vsftpd service:
service vsftpd restart
useradd user && mkdir /home/user
Fix permissions for user's home directory:
chmod a-w /home/user/
Make a new directory for uploading files:
chown user:user /home/user/files/