RBASH(1)

๐Ÿ“ฆ
version 5.3 ยท 4 versions
, in ubuntu resolute, ubuntu stonking

๐Ÿ’– 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, or BASH_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 -p option to the . builtin command to specify a search path.
  • Specifying a filename containing a slash as an argument to the history builtin command.
  • Specifying a filename containing a slash as an argument to the -p option to the hash builtin command.
  • Importing function definitions from the shell environment at startup.
  • Parsing the values of BASHOPTS and SHELLOPTS from the shell environment at startup.
  • Redirecting output using the >, >|, <>, >&, &>, and >> redirection operators. (no sneaky writing to files, we see you ๐Ÿ‘€)
  • Using the exec builtin command to replace the shell with another command.
  • Adding or deleting builtin commands with the -f and -d options to the enable builtin command.
  • Using the enable builtin command to enable disabled shell builtins.
  • Specifying the -p option to the command builtin command.
  • Turning off restricted mode with set +r or shopt -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