Ubuntu 10.04.4 LTS
I'm trying to chroot the user 'sam'. According to all the articles out there this should work, but apparently I'm still doing something wrong.
I changed /etc/ssh/sshd_config like this (at the bottom of the file):
#Subsystem sftp /usr/lib/openssh/sftp-server # CHROOT JAIL Subsystem sftp internal-sftp Match group users ChrootDirectory %h ForceCommand internal-sftp AllowTcpForwarding no
I added sam to the users group:
$groups sam sam : sam users
I changed the permissions for sam's home folder:
$ ls -la /home/sam drwxr-xr-x 11 root root 4096 Sep 23 16:12 . drwxr-xr-x 8 root root 4096 Sep 22 16:29 .. drwxr-xr-x 2 sam users 4096 Sep 23 16:10 awstats drwxr-xr-x 3 sam users 4096 Sep 23 16:10 etc ... drwxr-xr-x 2 sam users 4096 Sep 23 16:10 homes drwxr-x--- 3 sam users 4096 Sep 23 16:10 public_html
I restarted ssh and now sam can't log in with SFTP. The session is created, but also closed immediately:
Sep 24 12:55:15 ... sshd: Accepted password for sam from ... Sep 24 12:55:15 ... sshd: pam_unix(sshd:session): session opened for user sam by (uid=0) Sep 24 12:55:16 ... sshd: subsystem request for sftp Sep 24 12:55:17 ... sshd: pam_unix(sshd:session): session closed for user sam
Unexpected end of sftp stream. and other clients give similar errors.
What did I forget / what is going wrong?
I couldn't get it to work, even after contacting the OpenSSH mailinglist, so I decided to reset my entire server (which was a viable option, fortunately). It's working now.