sudo apt update
sudo apt install vsftpd
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
sudo ufw status
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo ufw allow 990/tcp
sudo ufw allow 40000:50000/tcp
sudo ufw status
sudo adduser ftp-user
sudo mkdir /home/ftp-user/ftp
sudo chown nobody:nogroup /home/ftp-user/ftp
sudo chmod a-w /home/ftp-user/ftp
sudo ls -la /home/ftp-user/ftp
sudo mkdir /home/ftp-user/ftp/files
sudo chown ftp-user:ftp-user /home/ftp-user/ftp/files
sudo ls -la /home/ftp-user/ftp
echo "vsftpd test file" | sudo tee /home/ftp-user/ftp/files/test.txt
sudo nano /etc/vsftpd.conf
###################################################
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
write_enable=YES
chroot_local_user=YES
user_sub_token=$USER
local_root=/home/$USER/ftp
pasv_min_port=40000
pasv_max_port=50000
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
echo "ftp-user" | sudo tee -a /etc/vsftpd.userlist
cat /etc/vsftpd.userlist
sudo systemctl restart vsftpd
ftp -p ip
cd files
get test.txt
put test.txt upload.txt