Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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"?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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? –  Dave Paroulek Jul 19 '11 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! –  Dave Paroulek Jul 19 '11 at 17:13
    
Do you use chroot to lock users in their home directories? I think maybe that's what is causing my problems? –  Dave Paroulek Jul 19 '11 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 '11 at 18:27
    
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 ;-) –  Dave Paroulek Jul 20 '11 at 13:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.