Restricted Shells

A restricted shell is one that disallows certain actions, such as changing directory, setting PATH, or running commands whose names contain a / character. See the Bash manpage for the full list of restrictions.

To run a restricted shell, enter the command bash -r. Depending on your Linux distribution, you may also be able to enter the command as rbash.

You can still run shell scripts, since in that case the restricted shell calls the unrestricted version of the shell to run the script after it reads /etc/profile, $HOME/.profile, and other startup files.

Restricted shells are not used much in practice, as they are difficult to set up correctly.

Get Linux in a Nutshell, 6th Edition 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.