Setting up a chroot sftp on debian server

Posted by Kevin Duke on Server Fault See other posts from Server Fault or by Kevin Duke
Published on 2012-10-08T19:45:43Z Indexed on 2013/11/05 4:00 UTC
Read the original article Hit count: 497

Filed under:
|
|
|
|

I'm trying to allow a user "user" to access my server by either sftp or ssh. I want to jail them into a directory with chroot. I read the instructions here however it does not work. I did the following:

  1. useradd user
  2. modify /etc/ssh/sshd_config and added

    Match User user

    ForceCommand internal-sftp

    ChrootDirectory /home/duke/aa/smart to the bottom of the file

  3. changed the subsystem line to Subsystem sftp internal-sftp

  4. restarted sshd with /etc/init.d/ssh restart

  5. logged in with ssh as user "user" with PuTTY

Putty says "Server unexpectly closed the connection".

Why is this and how can it be fixed?

EDIT

Following the suggestions below, I've made the bottom of sshd_config look like:

Match User user
   ChrootDirectory /tmp

yet no change. I do get a password OK but I cannot connect via ssh nor sftp. What gives?

© Server Fault or respective owner

Related posts about ssh

Related posts about debian