I'm trying to chroot an SFTP user to his home directory, but whenever I log in (using PuTTY), the SSH client closes.
This is what the auth.log says:
Aug 6 07:53:22 ip-xxx sshd: pam_unix(sshd:session): session opened for user bob by (uid=0) Aug 6 07:53:22 ip-xxx sshd: pam_unix(sshd:session): session closed for user bob
I added this to /etc/ssh/sshd_config:
Subsystem sftp internal-sftp Match User bob ChrootDirectory %h ForceCommand internal-sftp AllowTcpForwarding no X11Forwarding no Match
These are the permissions for the user's directory:
drwxr-xr-x 5 root root 4096 Aug 6 07:12 bob
And this is the output on the server:
debug1: PAM: password authentication accepted for bob debug1: do_pam_account: called Accepted password for bob from ip port 20784 ssh2 debug1: monitor_read_log: child log fd closed debug1: monitor_child_preauth: bob has been authenticated by privileged process debug1: PAM: establishing credentials User child is on pid 2907 debug1: SELinux support disabled debug1: PAM: establishing credentials Changed root directory to "/home/bob" debug1: permanently_set_uid: 1001/1001 debug1: Entering interactive session for SSH2. debug1: server_init_dispatch_20 debug1: server_input_channel_open: ctype session rchan 256 win 16384 max 16384 debug1: input_session_request debug1: channel 0: new [server-session] debug1: session_new: session 0 debug1: session_open: channel 0 debug1: session_open: session 0: link with channel 0 debug1: server_input_channel_open: confirm session debug1: server_input_channel_req: channel 0 request pty-req reply 1 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req pty-req debug1: Allocating pty. debug1: session_new: session 0 debug1: SELinux support disabled debug1: session_pty_req: session 0 alloc /dev/pts/1 debug1: server_input_channel_req: channel 0 request shell reply 1 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req shell debug1: Forced command (config) 'internal-sftp' debug1: Setting controlling tty using TIOCSCTTY. /dev/pts/1: No such file or directory open /dev/tty failed - could not set controlling tty: No such file or directory debug1: Received SIGCHLD. debug1: session_by_pid: pid 2908 debug1: session_exit_message: session 0 channel 0 pid 2908 debug1: session_exit_message: release channel 0 debug1: session_by_tty: session 0 tty /dev/pts/1 debug1: session_pty_cleanup: session 0 release /dev/pts/1 debug1: session_by_channel: session 0 channel 0 debug1: session_close_by_channel: channel 0 child 0 debug1: session_close: session 0 pid 0 debug1: channel 0: free: server-session, nchannels 1 Connection closed by ip debug1: do_cleanup Transferred: sent 3360, received 2096 bytes Closing connection to ip port 20784
I'm running a default Ubuntu server 12.04 LTS installation on an AWS instance.
I'm stuck here. For now, I have to remove the chroot jail for the user to log in. So any help is greatly appreciated!