I have the latest OpenSSH, I have a group "members" with 5 users. I need to get SFTP to certain directory, nothing else. I seem to be able to do it with Chroot, but it's not working. Heres my /etc/ssh/sshd_config: Subsystem sftp internal-sftp

Match Group members
        ChrootDirectory %h
        ForceCommand internal-sftp
        AllowTcpForwarding no

My error is this:

connect to address port 22: Connection refused
ssh: connect to host localhost port 22: Connection refused
Couldn't read packet: Connection reset by peer

I'm lost.

  • 2
    What version of OpenSSH are you using? "Latest" won't mean much after a couple of months. Also, what about the logs from the server? Oct 5, 2012 at 20:30
  • 2
    Though it is almost certainly not related to your connection refused message, you should read closely about the permissions required for the ChrootDirectory setting. The permissions requirements are very strict.
    – Zoredache
    Oct 5, 2012 at 20:54

1 Answer 1


The connection refused message usually means that there is nothing listening on the relevant interface:port.

The default for sshd is to listen on port 22 on all interfaces so the error message suggests that your sshd isn't configured to listen on

Check /etc/ssh/sshd_config to ensure that sshd is listening on port 22, if it's not then there will be a Port directive. Use -p with your utilities to connect to the non-standard port.

Check to see if sshd has been restricted to particular interfaces - there will be ListenAddress directives - if configured try connecting on the relevant IP address.

You must log in to answer this question.

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