I have previously setup a chroot to lock sftp users to their home directory only.

So I have this in sshd_config

Match User theuser
    ChrootDirectory /home/theuser
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand internal-sftp

and I'm assuming I need to remove the ForceCommand internal-sftp to allow ssh connection, but this gives me a 'Broken Pipe' message if I try to ssh from theuser.

I then need to allow public key access for that user, and hope to allow them to ssh-copy-id theuser@1234IP..

I am also assuming my answer is something to do with setting - authorizedkeysfile but this seems quite disruptive at best.

Any help is most appreciated - Thanks.

  • chroot environments don't play nicely with shell access since all the necessary programs are outside that environment. Jan 6, 2016 at 19:51

1 Answer 1


There is more than that. If you want to allow users ssh into chroot, you need to provide them at least shell and its dependencies. These files need to be copied into chroot.

You can find out what are the required shared libraries for bash using ldd (if your user has different shell use that one):

ldd /bin/bash

You will probably be able to see the errors that should guide you in the log. If not, give a try to running sshd in debug mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.