Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 just created a new user on my server, but I only want this user to have access to var/www/ and all the files/folders inside that.

They should be able to access no other files on the server except those.

How would I do this?


share|improve this question
Try to chroot that user to that directory. I can't give examples right now, but restricting to one directory does call for chroot. – DaDaDom Apr 28 '10 at 12:23
@DaDaDom if you do that, the user won't be able to execute anything, as there would be no /usr/bin, etc. – chmeee Apr 28 '10 at 12:51
@Michael why don't you tell us why you wan't to do that? – chmeee Apr 28 '10 at 12:52
well, I made a new user so the user can access the server via SFTP. I don't want him having access to the entire server, just var/www/. – Michael Apr 28 '10 at 12:59

The recommended way to do this is with SSH's recently added ChrootDirectory feature:

share|improve this answer

Your Answer


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