Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server with multiple sites hosted in my user directory /home/[user]/public_html/[site directories] and so I have access over SSH/SFTP.

I now have somebody working for me and want them to be able to update the sites but don't want them to have unrestricted access to the server. I basically want to restrict them to SFTP access to the public_html directory in my user home directory whilst still allowing my access to these directories as well.

Is this possible? How can I do this? I don't want to add an FTP client - just using inbuilt SSH.

I am aware it would be better to create multiple home directories but creating one for each site hosted isn't really a feasible short term option.



share|improve this question

Yes, it is possible. You have to use the "ChrootDirectory" directive. ( man sshd_config ). If you want to chroot only a specific user and your ssh version has sftp builtin:

Match user the_user_you_want_to_chroot
         ChrootDirectory /home/whatever/%u
         ForceCommand internal-sftp

( Be sure to check the manpage as it can be different )

share|improve this answer
This is not going to work because: 1) all components should be owned by root which I doubt (on newer Ubuntu's, from memory Lucid+?) 2) filesystem permissions prevents the logged in user from writing to the directory /home/[user]/public_html/[sitedir] (assuming [user] != ssh user and [sitedir] is owned by [user]) – Lekensteyn May 6 '11 at 11:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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