I just set a user to use rbash (I wanted to user to be able to access it's home directory only). However when I try to change sub-directory it always gives me:

-rbash: cd: restricted

The sub-directory owner is this logged in user, so I don't know why it is restricted. Any idea/help?

  • I suggest you open a terminal and type man rbash – Charles Green Jun 28 '14 at 4:04

From the rbash man page:

A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the following are disallowed or not performed:

  • changing directories with cd

rbash does not discriminate. It will not allow any cd, no matter where you're going. Even if it's a subdirectory of the user's home folder.

IMHO in a real-life situation there really isn't a use for rbash. However, there are other things you can do to prevent users from seeing your stuff. For example, you could run:

chmod -R o= $HOME

This changes the permissions of all the files in your home folder ($HOME) and subdirectories (-R = recursively), giving other users no permissions (that's what the o= part means) to access, modify, or even list files within.

Hope this helps.

| improve this answer | |

Your Answer

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

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