1

I have multiple directories spread over the file systems of multiple Ubuntu 10.04 servers.

The requirements are to allow a handful of people access a few of these directories over ftp.

For example joe needs to ftp files to /apps/app1. alice needs ability to ftp to /apps/app2 and /mnt/apps/app4 (nfs share to another server)

I really want to keep vsftpd chroot so that these users can't see anything but home directory.

All these users are ldap users. Their home directories are automounted from a central server.

So, ideally, when joe ftp's in, he should see a single directory named "app1". When alice ftps in, she should see directories named "app2" and "app4". Eventually, I'll need to add more "virtual" dirs. For example, alice might need access to /apps/app5 in a few weeks. I'd like to be able to add it so that when she ftp's in, she sees "app2", "app4" and "app5".

It seems like it should be easy, but I've been running in circles on how to get this to work.

OPTION 1

I've tried using fstab and/or autofs to mount stuff using --bind under user home directories. This kinda works. It's annoying that when you use autofs, the directories are not visible via ftp unless someone has accessed them recently.

Why OPTION 1 fails:

Same reason as OPTION 3

OPTION 2

I've tried using soft links, but again, this doesn't seem to work. I created a nfs mounted drive (using autofs) at /mnt/apps/app1. Then I create a link like so ln -s /mnt/apps/app1 /home/ldap/joe/app1.

Why OPTION 2 fails:

When I log into ftp as joe, I can see "app1" dir, but if I try to open it, I get: 550 Failed to open file. Error: Critical file transfer error. Note that /home/ldap/joe is an auto mounted drive that is physcially on a different server under /apps/exports/home/joe. I've read some other places that once a user is chrooted, they can't follow symbolic links outside their home dir.

OPTION3

Configure all users so they have the same home directory, then mount shared dirs under common home dir. If you use autofs, the dir names doen't show up when. If I use fstab, it's very close to a workable solution.

Why OPTION3 fails: I'm able to mount local dirs fine. But when I try to mount --bind <some mapped drive> /apps/app1, then when I ftp and browse the directory, I see a 500 Failed to change directory.

Anyone have an elegant solution for this problem? Maybe there's another ftp server that supports "virtual directories"?

1 Answer 1

1

What problems have you been having with symbolic links? I've done this many times.

  1. Use ACLs to give them permissions (preferable a group based permission)
  2. Create Sym link in the home directory

You'll need to do a bit of scripting to be able to create the sym links for people automatically, but that shouldn't be too hard.

5
  • I created a nfs mounted drive (using autofs) at /mnt/apps/app1. Then I create a link like so ln -s /mnt/apps/app1 /home/ldap/joe/app1. When I log into ftp as joe, I can see "app1" dir, but if I try to open it, I get: 550 Failed to open file. Error: Critical file transfer error. Note that /home/ldap/joe is an auto mounted drive that is physcially on a different server under /apps/exports/home/joe...but not sure if that matters? Jul 19, 2011 at 17:11
  • Also, group1 has rwx to /mnt/apps/app1, and joe is a member of group1. Thanks so much for your help. If you've used symlinks before, it gives me hope! Jul 19, 2011 at 17:13
  • Do you use chroot to lock users in their home directories? I think maybe that's what is causing my problems? Jul 19, 2011 at 17:16
  • @Dave yep, although the problem may be with NFS, we where using a local(ish - and by ish i mean iSCSI) setup.
    – Zypher
    Jul 19, 2011 at 18:27
  • 1
    thanks again for your help. Unfortunately, symlinks won't work for me because I verified that chroot prevents users from following the symlinks. Without chroot, they work great ;-) Jul 20, 2011 at 13:58

You must log in to answer this question.

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