2

I recently moved my website to a CentOS 6 VPS (from a HyperVM-enabled CentOS 5 VPS). I set up vsftpd to handle our FTP needs. I created a local user for everyone who needs to use the FTP. For my user Joe, he logs in with FileZilla and lands in /home/joe. Joe can use that folder for private storage, but I have put a symlink so he can access public storage at /var/www/html/storage.

So in his directory, I did as root: ln -s /var/www/html/storage/ storage

For some reason the ending / is necessary, or else storage will appear as a file in FileZilla instead of a shortcut to a directory.

Anyway, while in /home/joe, when Joe navigates to storage his path suddenly becomes /var/www/html/storage instead of /home/joe/storage. This makes it hard to navigate back up to the parent folder into his home directory.

Is there a way to correct this?

chroot is disabled on my server, and that's fine. I trust my users, but it's just inconvenient for them to be thrown around the filesystem like that via the symlinks. If I do enable chroot then they won't be able to get to /var/www at all.

The bizarre thing is that this worked on my previous VPS with HyperVM. But that one used PureFTP instead of vsftp. And I think it created virtual users instead of real local users on the machine. Are virtual users necessary to be able to do symlinks the way I want?

Another solution I researched was using mount --bind, but I am unsure if this is the best action to take. Will it wreck my filesystem to have tons of mount points? It also just feels improper when ln -s ought to be working. If I SSH into my server as Joe, I am able to go to /home/joe/storage in a bash shell. So why can't I do it in FTP?

As a side note, does this have something to do with LIST versus MLSD in FTP clients? I have a Mac user who is not able to see the symlinks as symlinks at all, even if I put a trailing / in the link.

1 Answer 1

2

i would do the mount --bind option.. as it would at least perserve the pathing in filezilla.

Also doing that if you wanted to enable chroot in vsftp so the user see's /home/user as / it would add more security but the mount --bind would allow the user to still get to that directory while the symlink would not

2
  • All right. And according to this other question it looks like I have to edit /etc/fstab to re-mount all the links after a system reboot.
    – Crisu
    Oct 24, 2011 at 4:26
  • Yes that is the best way to do it
    – Mike
    Oct 24, 2011 at 13:29

You must log in to answer this question.

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