8

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.

2 Answers 2

15

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....

3
  • thanks, I just saw this on another site as well, when I try it I get this "mount: can't find /path/here in /etc/fstab or /etc/mtab" UPDATE, I see that you kind of explain this in that forum thread.
    – dan.codes
    May 4, 2010 at 20:47
  • If you haven't already set it up in /etc/fstab, then you need to specify both the existing directory and the mount point in your mount command. Once /etc/fstab is configured you can just mount it by either the mount point directory name or the existing directory name. May 4, 2010 at 21:14
  • hi, how do I see my current mounts ?
    – Stewie
    May 6, 2011 at 19:34
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .