User Tools

Site Tools


linux:misc:vsftpd

Add vsftpd users to manage apache www folder on ubuntu

So, you have a web server and would like to modify the content via vsftpd. After you have installed vsftpd, modify /etc/vsftpd.conf:

# Enable this to allow users to write files to their web folder
write_enable=YES
# To restrict users to specific web folders and block access to parent folders
chroot_local_user=YES
# You may want to enable passive mode if you have a firewall
pasv_enable=YES
pasv_min_port=65000 (example, set your own)
pasv_max_port=65535 (example, set your own)
# Also remember to open up port 20 for FTP-DATA, 21, and 990 for TLS/SSL on your firewall

Next create your users and add them to the web group

useradd -s /usr/sbin/nologin {new_username}
sudo passwd {new_username} # you will be prompted to enter a password twice
sudo usermod -d /var/www/{web folder} {new_username}
usermod -a -G www-data {new_username}

Next, modify /etc/shells by adding the following line at the bottom:

/usr/sbin/nologin

Finally, restart your ftp server

service vsftpd restart

Now test your new web ftp user account and check if the directory is writable and also make sure the pages are viewable in a browser.

linux/misc/vsftpd.txt · Last modified: 2017/11/28 21:10 by tplecko