Currently setting up a Centos6.4 box and are wanting to jail sftp users upon login. I've been following the notes here http://www.thisisnotsupported.com/sftp-chrootjail-on-centos6. But I have one issue relating to the user home directory.

This tutorial lists the ChrootDirectory as

ChrootDirectory /var/www/vhosts/%u

This uses the user name for the home directory. However, I have specified a different home directory for the user which I would like to use instead. When attempting a login the directory looked for is based on the user name and not the specified home directory.

I've searched the documentation for the relevant % key I should be using here but have come up blank.

Can anybody assist and suggest which key I should be using here?

Many thanks

1 Answer 1


Appears that you can use %h which the uses the specified home directory so in my case:

ChrootDirectory %h

Another concern is the requirement for the container folder to be owned by root should any one stumble across this.

  • 1
    Keep in mind that the directory has to be owned by root so you need to create a subdirectory for the user to be able to write anything. Aug 19, 2013 at 14:47

You must log in to answer this question.

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