RBASH(1)
๐ RBASH โ the girlies' guide to restricted bash ๐
okay so bestie, welcome to the rbash manual page, straight out of the General Commands Manual section. That's the manual name btw, not a vibe โ every page in this section says it. And rbash? It stands for restricted bash, and for the full tea you gotta go read bash(1). This page is just the restricted-flavour deluxe edition. ๐
โจ NAME โจ
rbash โ restricted bash, see bash(1)
That's it. That's the whole name section. Short and iconic. ๐
๐ RESTRICTED SHELL ๐
So here's the deal, queen. If bash gets started with the name rbash, or if you hand it the -r option at invocation, the shell becomes restricted. A restricted shell is what you use when you want an environment that's, like, more controlled than the standard shell โ training wheels but make it security. ๐ฆ
It behaves identically to bash, no cap, with the one exception that the following things are disallowed or just straight up not performed:
- Changing directories with
cd. (no wandering off bestie, stay put ๐ซถ) - Setting or unsetting the values of
SHELL,PATH,HISTFILE,ENV, orBASH_ENV. (hands off, those are not yours to touch) - Specifying command names containing
/. - Specifying a filename containing a
/as an argument to the.builtin command. - Using the
-poption to the.builtin command to specify a search path. - Specifying a filename containing a slash as an argument to the
historybuiltin command. - Specifying a filename containing a slash as an argument to the
-poption to thehashbuiltin command. - Importing function definitions from the shell environment at startup.
- Parsing the values of
BASHOPTSandSHELLOPTSfrom the shell environment at startup. - Redirecting output using the
>,>|,<>,>&,&>, and>>redirection operators. (no sneaky writing to files, we see you ๐) - Using the
execbuiltin command to replace the shell with another command. - Adding or deleting builtin commands with the
-fand-doptions to theenablebuiltin command. - Using the
enablebuiltin command to enable disabled shell builtins. - Specifying the
-poption to thecommandbuiltin command. - Turning off restricted mode with
set +rorshopt -u restricted_shell. Like, absolutely not. The whole point is that it stays on. ๐
Timing matters, bestie: these restrictions are enforced after any startup files are read. So the startup files get their moment, and then the lock clicks shut. ๐
One more lil plot twist: when a command that turns out to be a shell script gets executed, rbash turns off any restrictions in the shell that's spawned to run that script. So the script itself runs unrestricted โ it's giving "the rules apply to you, not to the script." ๐
๐ SEE ALSO ๐
Yeah that's the only one. Go read it, it's the whole lore. ๐
And that's the page, gorgeous. Sending you off with the receipts: this was Bash-5.2, dated 2021 November 22. ๐ธ Stay restricted, stay slay. ๐โจ๐
๐ฆ where this page comes from
- ubuntu resolute: bash 5.3-2ubuntu1 ยท GPL-3.0-or-later
- ubuntu stonking: bash 5.3-3ubuntu1 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms