An easy (read: automated) way to set up FTP jails for each user in their respective folder so they can access, upload, and edit site files – with multiple instances on the same server.
A tutorial about FTP configuration with multiple users and directory restriction.
PROFTPD INSTALLATION
Update your packages repository list and install proftpd server
apt-get update && apt-get install proftpd
Then edit proftpd configuration file :
nano /etc/proftpd/proftpd.conf
And just remove the # at the beginning of the line
DefaultRoot ~
Restart proftpd server to apply the configuration
service proftpd restart
ADD A NEW FTP USER
To add a user, it requires to define his home folder, which is the website folder you want to use, and to include our ftp user in group www-data.
Just replace the folder and user in the following command :
adduser --home /var/www/yourdomain.ltd/ --ingroup www-data your-ftp-user
The last step is to edit permissions on your website folder
chmod -R g+rw /var/www/domainname
You can now login with your favorite ftp client, and your new user will only be able to access to his home folder.