The restricted shell
There are different ways to 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. The user will be prevented to set or unset the values for the following environment variables:BASH_ENV
ENV
SHELL
PATH
- The user will not be able to specify command names with slashes and this means no command names with absolute paths.No filenames containing a slash can...