In this recipe, we will learn about chroot and restricted bash(rbash). The chroot
command is used to change the root directory. Using rbash, we can restrict some features of the bash shell for some security purposes.
Besides having a Terminal open, you need to ensure that rbash
is installed in the system.
- Now, we will look at the command to start
rbash
. Run the following command:
$ bash -r or $ rbash
- Now we will test some restrictions. First, we will try to change the directory. Run the following command:
$ cd work/
Next, we will try to write some contents to the file. Run the given command to write some contents into the file:
ls > log.txt