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

I've successfully set up SFTP to chroot a user to their home directory.

However, I have a case that I haven't been able to find any examples on, and the odd permissions needed for chroot make me wonder if I can do this.

I need to have a user, say, "fileadmin" that can create new folders under their home folder (via SFTP - they won't be logging in with a shell unless something is being debugged/etc) that then become new user's chrooted folder. This way, fileadmin can upload files for these other users that they can then pull down (read-only access is fine).

So an example of the filesystem setup would be: /home/fileadmin/ (fileadmin's home folder) /home/fileadmin/rouser1 /home/fileadmin/rouser2 etc...

User fileadmin doesn't need to be a chrooted account - it's the one we control and I trust it.

I've put fileadmin and rouserX in the same group and set the subfolders ownership as that group.

When I attempt this setup, I get: fatal: bad ownership or modes for chroot directory component when I log in with any of the "rouserX" accounts.

Anyone have any idea how to set up the permission to make this work? Is it possible?

The rouserX accounts are stored in openldap, so the idea would be that they would be added after the folder was created by fileadmin (via a backend ldap webapi I'm not involved with).

share|improve this question
    
Possible duplicate of this question –  dawud Apr 11 '13 at 19:33
add comment

2 Answers 2

It is required that all directories from the home of the chrooted user to the root must be owned by root:root and must not be group or world writable. This is probably not the case for fileadmin home directory.

This is very similar to this question.

share|improve this answer
add comment

Thanks. I found one way to do it was to set the chroot for all users the same, then set home directory down from there (ie: /chroot and user "test" was /home/test which was effectively /chroot/home/test). This works the way I want it, sort of. The problem is, since I had to use group perms to make it work, user2 could get into user1's folder if they knew the correct path.

I ended up compiling ProFTPD with SSH/SFTP support and it works exactly the way I want.

share|improve this answer
add comment

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.