1

I've recently run into some problems while trying to setup a FTP server a certain way. I have a client who has a LOT of data put into one folder. The client then has various directories by which the data is organized. At the end (of the "directory filter") they have a symbolic link that points to a file in the massive data folder. E.g

/lab/directory1/type2/data/owner/lab/bla/bla/file---->/lab/data/filexyz

In order to replicate and setup a "FTP" server, I simply created a directory called /lab/data/ and copied all the data on there. I then just copied the symbolic link folder structure.

I then setup vsftpd. Created a local user with a false bin and set that users home directory to /lab The problem I run into is that when I have chroot_local_user=YES enabled in the config file, the user is unable to get the file the server gives 550 Failed to open file. why is this the case. The symbolic link is pointing to a file that is in their home directory. However when I have chroot_local_use=NO the user is able to download the files seamlessly. Is there way to enable the user to get files via symbolic links that are in their home directory while being chroot jailed?

I've been scratching my head over this. Thanks!

4 Answers 4

4

A symbolic link is a pointer to the "right" file. But if that original file is outside the jail then you can't access it. This is the goal of a jail. Otherwise a normal user could create a symbolic link in the jail to /etc/passwd and just read it. What a security risk!

So jailed is jailed. Probably a hard link will do the job, as this is a "copy without duplicating the used size". And for the FTP server it is like a normal file (with all the problems).

7
  • But here is the thing, the symbolic link is inside the home directory of the user. I cannot create hard links because the files are not on the same file system. They are on EBS volumes in amazon mounted on a folder inside the users home directory.
    – Falcata
    Aug 15, 2011 at 17:29
  • The symbolic link itself is the problem. Not the target of the symbolic link. So probably this is why it is called vsftpd (very secure ...). You could try ProFTPd which is able to follow symlinks.
    – mailq
    Aug 15, 2011 at 18:02
  • Thanks for the reply maliq. I'm looking into proFTPd right now, is there no way to make it work with VDFTPD?
    – Falcata
    Aug 15, 2011 at 18:44
  • No way with symlinks. Use hard links, no jail or the method mentioned by @Eno.
    – mailq
    Aug 15, 2011 at 18:48
  • I keep on bugging you :(. So I tried using proftpd and I followed the tutorial here: proftpd.org/docs/howto/Chroot.html I cannot see the symbolic link: e.g: I want to create a link to /lab/data/009.txt in the folder /lab/somefilter/filter1/test/ by the name of thisfile.txt so /lab/somefilter/filter1/test/thisfile.txt ---> /lab/data/009.txt This does not seem to work. Any thoughts? Thanks :)
    – Falcata
    Aug 15, 2011 at 20:19
3

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.

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

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

mkdir /home/website/files/

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

Taken from here:

Setup symbolic link where users can access it with FTP

1

You should use something like mount --bind

0

I had this problem because I used absolute paths to the link target.

my command was:

ln -s /var/www/vhost/myhost.com/typo3_src/typo3_src-8.7.6/ typo3_src

... typo3_src did not show up in the FTP client

when I used relative paths it worked:

ln -s typo3_src/typo3_src-8.7.6/ typo3_src

You must log in to answer this question.

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