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 am trying to chroot my SSH users to their home directories and it seems to work.. in a strange way. Here is what I have in my sshd_config:

Match group restricthome
    ChrootDirectory %h

The permissions on the user directories looks like this:

drwxr-xr-x  2 root root 1024 May 11 13:45 [user]/

And I can see that the user logs in successfully:

May 11 13:49:23 box sshd[5695]: Accepted password for [user] from x.x.x.x port 2358 ssh2 (with no error messages after this)

But after entering the password the PuTTY window closes down.

This is a wild guess, but could it be because the user's shell is set to /bin/bash and it can't execute because of the chroot? If so, could you give me pointers on how to fix it? Would simply copying the bash binary into user's home directory and modyfying the shell work? How would I deal with the dependencies, ldd shows quite a few of those :)

Comments/suggestions will be appreciated.

Thanks.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

This is a wild guess, but could it be because the user's shell is set to /bin/bash and it can't execute because of the chroot?

Your guess was correct. When you put the user into a chroot environment, he can't access files outside the environment.

There are several scripts which help you create a complete chroot environment for your users, e. g. Jailkit.

share|improve this answer
    
Thanks for your suggestion, I will check out Jailkit. –  Hamza May 26 '10 at 15:41

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.