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

How do I make a user account using useradd and give the user access to only the dir where he can just read write files. The user when login goes to this base dir I provide and cannot access anything else on the system.Thanks

share|improve this question

migrated from Jun 24 '11 at 16:20

This question came from our site for professional and enthusiast programmers.

A typical user already behaves almost in this fashion -- that is, if you create a user with useradd, that user will only be able to write files in their home directory (and in a few other locations such as /tmp and /var/tmp).

You can't meaningfully prevent them from having read access in a number of places -- for example, the user needs read access to files and directories like /usr/bin. You can substantially limit what is visible to the user by having them run in a chroot environment, but this can be tricky to set up.

You're much better off ensuring that data that shouldn't be visible to arbitrary users is protected by the appropriate permissions.

share|improve this answer

Rather than setting up a chroot a simpler solution may be to use a restricted shell (such as rbash). See and .

share|improve this answer

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.