You are using a webserver like apache2 or lighttpd to host websites under the /var/www directory, and letting your linux users upload and edit the files in their home folder via ftp.
Each user use their own domain, and maybe you have set up virtualhosts in apache2.
That is a convenient way to host multiple sites for multiple people, but, you may have a problem if you are using the traditional symlink between the two folders; users home directory, and the webservers default root directory.
Say you have 2 users, with 2 different websites:
- Home folder: /home/Jen
- Documentroot, virtualhost: /var/www/jen.com
- Home folder: /home/Alex
- Documentroot, virtualhost: /var/www/alex.com
And you are using vsftpd, with the setting chroot_local_user=YES so that users are limited to their own home folder.
You could then create a symlink
ln -s between /home/Alex/alex.com and /var/www/alex.com so Alex could manage his website from his home directory. that would work, but not via ftp, since it does not follow symlinks outside Alex’s home folder.
This took me some time to figure out, but the solution is actually simple.
Instead of using the traditional symlink, you can in linux mount two folders like this:
Make sure the directories
/var/www/alex.com exists (create them with mkdir)
Then mount the two folders with
mount –bind /home/Alex/alex.com /var/www/alex.com
Now Alex should be able to update his website files in his home folder, via ftp, and at the same time, apache can serve his website from the default
/var/www directory (ubuntu default).
This is a simpler workaround, a solution, but not to the specific problem of giving ftp users access.
Instead of symlinking or mounting directories between apaches www folder and users home folder, you could just point the documentroot of the apache virtualhosts to
But then you scatter your webfiles around the server, and make running backups harder.