0

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:~$

2
  • Is this a duplicate of serverfault.com/questions/39997/… ?
    – davr
    Jul 13, 2009 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, 2009 at 13:13

2 Answers 2

2

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

1
  • I had to change the /etc/passwd it pointed to the wrong chrooted bash
    – Malfist
    Jul 13, 2009 at 21:02
0

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .