chroot'ing SSH home directories, shell problem.

Posted by Hamza on Server Fault See other posts from Server Fault or by Hamza
Published on 2010-05-11T13:00:25Z Indexed on 2010/05/11 13:04 UTC
Read the original article Hit count: 339

Filed under:
|
|
|

Hi folks,

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.

© Server Fault or respective owner

Related posts about ssh

Related posts about openssh