Home VPN WorkPlace Web Sites/Apps Small Business Other Apps Contact Guides

FTP Server on Ubuntu 20.04

https://www.sigerr.org/setup-vsftpd-custom-multiple-directories-users-accounts-ubuntu-step-by-step
Install VSFTPD
sudo apt install vsftpd libpam-pwdfile apache2 -y
Get current VSFTPD Status
sudo service vsftpd status
Configure FTP Service
sudo nano /etc/vsftpd.conf
listen=YES anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 nopriv_user=vsftpd virtual_use_local_privs=YES guest_enable=YES user_sub_token=$USER local_root=/[ftproot]/$USER chroot_local_user=YES hide_ids=YES guest_username=vsftpd chroot_list_enable=YES

Add Config Directory
sudo mkdir /etc/vsftpd

Setup PAM
sudo nano /etc/pam.d/vsftpd
auth required pam_pwdfile.so pwdfile /etc/vsftpd/ftpd.passwd account required pam_permit.so
Create Server Side User without Shell Access
sudo useradd --home /home/vsftpd --gid nogroup -m --shell /bin/false vsftpd

Create a virtual user (Requires Apache2 htpasswd)
sudo htpasswd -cd /etc/vsftpd/ftpd.passwd [username]
Create user directory structure
mkdir /[ftproot]/[username]
sudo chmod -w /[ftproot]/[username]
mkdir /[ftproot]/[username]/www
sudo chmod -R 755 /[ftproot]/[username]/www
sudo chown -R vsftpd:nogroup /[ftproot]/[username]

Restart Service
sudo systemctl restart vsftpd

Delete User
sudo htpasswd -D /etc/vsftpd/ftpd.passwd [username]