Setup symbolic link where users can access it with FTP

I have a folder on a server where a client of mine has a bunch of folders that they upload images and what not for a site, I do a symbolic link to those folders to the root of the website. This way I can give them ftp access to upload whatever they need without having access to the root level of the website.

I have another folder that I can't setup as a symbolic link to their folder, which has images they need to upload to. I know that if I create a symbolic link the other way around where the sym link is in their folder, they can't access it through FTP.

There has to be a way without creating two separate FTP accounts and give a user the ability to upload to a different directory that is outside of their home directory. I see that it is ftp specific and that there are some settings that can be changed but I haven't seen any clear cut answers for the best way to handle this.


Solution 1:

You can use the bind option of mount to remount the other folder so the FTP server sees the files as being within the root of the website.

I posted an answer to the same question on UbuntuForums.org.

...You could mount /home/shared/files/ under /home/website/files/ like this.

  1. Create a mount point ( a directory ) in /home/website

    mkdir /home/website/files/

  2. Mount the other directory under this mount point

    mount --bind /home/shared/files /home/website/files/

It will now appear that those files are actually under /home/website/ so will be available even if you restrict the user to this website root directory....

Solution 2:

If you want to redirect your ftp connection to another folder

you can edit the file /etc/fstab and add the line :

/var/www/website /home/userftp/html auto bind,defaults 0 0

and after mount the folder :

mount /home/userftp/html