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 been following this tutorial http://olivier.sessink.nl/jailkit/howtos_chroot_shell.html to setup a chroot jail for my ssh users.

My sshd_config has this in it:

Match group backup-users
        ChrootDirectory /home/jail/

But what happens when I log in is that the ssh connection gets terminated immediately.

The /var/log/auth.log says:

Jul 13 19:37:02 obu1 sshd[21225]: Accepted password for testuser from ###.###.###.### port 63718 ssh2
Jul 13 19:37:02 obu1 sshd[21225]: pam_unix(sshd:session): session opened for user testuser by (uid=0)
Jul 13 19:37:03 obu1 sshd[21225]: pam_unix(sshd:session): session closed for user testuser

What am I doing wrong?

output of attempted ssh:

jerome@obu1:~$ ssh localhost -p 222 -l testuser
testuser@localhost's password:
Linux hostname 2.6.26-2-amd64 #1 SMP Sun Jun 21 04:47:08 UTC 2009 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jul 13 20:08:55 2009 from localhost
Connection to localhost closed.
jerome@obu1:~$

share|improve this question
    
Is this a duplicate of serverfault.com/questions/39997/… ? –  davr Jul 13 '09 at 22:44
    
No, the other asked how to get ssh working with a chroot jail, not how to setup the said chroot jail. –  Malfist Jul 14 '09 at 13:13

2 Answers 2

up vote 2 down vote accepted

is there a copy of the user's shell inside the jail?

share|improve this answer
    
I had to change the /etc/passwd it pointed to the wrong chrooted bash –  Malfist Jul 13 '09 at 21:02

Do you check the permissions for the home folder? That kind of error happens to me when permissions are wrong.

share|improve this answer
    
what should the permissions be? –  Malfist Jul 13 '09 at 19:53
    
the user 'testuser' owns /home/jail/home/testuser –  Malfist Jul 13 '09 at 19:59
    
permissions of the testuser's homefoldeR: drwxrwxrwx 3 testuser root 4096 2009-07-13 20:38 testuser –  Malfist Jul 13 '09 at 20:42

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.