, ######################## , local_enable=YES , write_enable=YES , chroot_local_user=YES , ######################## , adduser user-name --home /var/www/html/user-name , # if existing user # mkdir /var/www/html/user-name , mkdir /var/www/html/user-name/html , chmod a-w /var/www/html/user-name # this becomes the chroot jail , chown user-name:user-name /var/www/html/user-name/html # this becomes the ftp users root , , #change location of users home directory# usermod -d /newhome/username username , , , , pete@hp-stream:/var/www/htdocs$ sudo adduser user2 --home /var/www/html/user2 , pete@hp-stream:/var/www/htdocs$ sudo mkdir /var/www/html/user2/html , pete@hp-stream:/var/www/htdocs$ sudo chmod a-w /var/www/html/user2 , pete@hp-stream:/var/www/htdocs$ sudo chown user2:user2 /var/www/html/user2/html , pete@hp-stream:/var/www/htdocs$ sudo touch /var/www/html/user2/no_files_here , ######################### , , , , , vsftpd server setup , , ** For the ubuntu-16.04 install on digital-ocean I only enabled local user write and chroot yes ** , , The directory /var/www/html/ becomes the chroot DQjailDQ. In that DQjailedDQ directory , there is no write access, only read. So we create a directory in that and assign , permissions that allow read, write and execute. , , #Error: 500 OOPS: vsftpd: refusing to run with writable root inside chroot() , #added: echo allow_writeable_chroot=YES >> /etc/vsftpd/vsftpd.conf , , , locked down (jail) -- /var/www/html/ , open -- /var/www/html//htdocs , , Check and see if user exists: sudo tail /etc/passwd , Add user and specify home dir: sudo adduser --home /var/www/html/ , Delete a user and their home directory: sudo userdel -r , Change a users home directory: usermod -d /newhome/username username , , sudo adduser --home /var/www/html/ , sudo chown nobody:nogroup /var/www/html/ , sudo chmod a-w /var/www/html/ , , sudo mkdir /var/www/html//htdocs , sudo chown : /var/www/html//htdocs , , example: sudo chown ftpuser:ftpuser /var/www/html/ftpuser , , to delete a block of text using nano: , , use CTRL + Shift + 6 to mark the beginning of your block. , move cursor with arrow keys to end of your block, the text will be highlighted. , use CTRL + K to cut/delete block. , , , Edit the file /etc/vsftpd.conf and add and alter the declarations below: , , listen=NO , listen_ipv6=YES , anonymous_enable=NO , local_enable=YES , write_enable=YES , local_umask=022 , dirmessage_enable=YES , use_localtime=YES , xferlog_enable=YES , connect_from_port_20=YES , chroot_local_user=YES , secure_chroot_dir=/var/run/vsftpd/empty , pam_service_name=vsftpd , rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem , rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key , ssl_enable=NO , pasv_min_port=40000 , pasv_max_port=50000 , user_sub_token=$USER , local_root=/var/www/html/$USER , userlist_enable=YES , userlist_file=/etc/vsftpd.userlist , userlist_deny=NO , listen_port=45000 , , , Create or edit the userlist file: , , sudo nano /etc/vsftpd.userlist , , sudo systemctl restart vsftpd , ,