How to chroot a user to a particular folder of another user

- I have created an stfp user alpha

  • I want to limit his sftp access to a subfolder of another user /home/beta/subfolder

  • the chroot setting is

Match User alpha
    ChrootDirectory /home/beta/subfolder
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand internal-sftp

but the ftp gives me error

Error:    Connection reset by peer
Error:    Could not connect to server

If I change ChrootDirectory to /home only it works all fine.

What could be the issue ? please help.

1 Reply

If I am remembering correctly, the chroot directory needs to be owned by root.

edit: the library article on sftp jails seems to confirm this.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct