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?


  • 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:


Your Answer

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