Installing and configuring FTP server on on Ubuntu 12.04 and adding users
As for good FTP server for Ubuntu I’ve choosen
vsftp server, though it has some glitches (more here), after fairly good response in the Internet. Many guides shows how to configure and use
vsftp on local users, though giving them, by default, access only to their home folder. And allowing them to access server via SSH.
Which is not, what we want in most cases.
I’ve found a good guide, which shows you how to add ftp users with access to folder inside WWW root only.
You can find this guide here. Follow it step-by-step, to install and configure
vsftp and to add non-SSH users, that is the one, that won’t be able to access your server via SSH. In the same time, they’ll have only access to selected folder inside WWW root. Which is most perfect solution for creating users, that will only able to update their own websites, with absolutely no access to other server’s or system’s parts.
Following above mentioned guide, you should replace any reference to
/path/to/your/dir to a subfolder created in your WWW root folder. In case of Ubuntu 12.04 LTS, this would be
/var/www/site-name for example. This way you’ll give newly create user access to only his or her site files.
Consider, that mentioned guide has a small bug. In the step previous before last (that is: “Create a usergroup and add ‘username’ to it“) first command to execute is wrong. Instead of:
sudo addgroup username
you should certinally execute:
sudo addgroup ftpusers
Also, if you’re using Ubuntu 12.04 LTS or any other that has
vsftp 2.3.5 as the newest version, you’re strongly advised to update it manually to 3.0+ version, to avoid
500 OOPS: vsftpd: refusing to run with writable root inside chroot() error. More [here](Fixing 500 OOPS vsftpd refusing to run with writable root inside chroot on Ubuntu 12.04.txt).
There is a very good text in Ubuntu Help about
vsftpd along with great explanation of all the issues, configuration switches etc.