The restricted shell

There are different ways to restrict what a user can do on a system and there are a lot of reasons why we would restrict a user's ability to interact with a system: maybe we want a user just to be able to copy a file to and from the system or to have a simple home where they can work on their tasks without peeking around the system. Anyway, whatever is our goal we can start working with a restrict shell.

Bash itself offers an additional layer of security using the following options:

  • rbash
  • --restricted
  • -r

Invoking rbash or simply bash with the --restricted or -r options spins a Bash instance that trims down what the users will be able to do on such an environment:

  • The user cannot change the directory using the cd builtin. ...

Get Mastering Bash now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.