Set Users as chrooted for sftp, but allow user to login in SSH

Posted by Eghes on Server Fault See other posts from Server Fault or by Eghes
Published on 2013-10-17T11:49:07Z Indexed on 2013/10/17 16:03 UTC
Read the original article Hit count: 294

Filed under:
|
|
|

I have setup a ssh server on debian 7, to use sftp connection.

I chrooted some user, with this config:

Match Group sftpusers
    ChrootDirectory /sftp/%u
    ForceCommand internal-sftp

But if i want login with one of this chrooted users in ssh console, they get logged, but autoclose the connection. In logs I see:

 Oct 17 13:39:32 xxxxxx sshd[31100]: Accepted password for yyyyyy from   zzz.zzz.zzz.zzz port 7855 ssh2
 Oct 17 13:39:32 xxxxxx[31100]: pam_unix(sshd:session): session opened for user yyyyyyyyyyyy by (uid=0)
 Oct 17 13:39:32 d00hyr-ea1 sshd[31100]: pam_unix(sshd:session): session closed for user yyyyyyyyyyyy

How can I chroot a user only for sftp, and use it as a normal user for ssh?

© Server Fault or respective owner

Related posts about linux

Related posts about ssh