blob: 9478fc64f15d466f7c745dfaf7291598fe87b3b9 [file] [log] [blame]
Jari Aalto95732b42005-12-07 14:08:12 +000016.10 The Restricted Shell
2=========================
Jari Aalto7117c2d2002-07-17 14:10:11 +00003
Chet Rameya0c0a002016-09-15 16:59:08 -04004If Bash is started with the name 'rbash', or the '--restricted' or '-r'
Jari Aalto7117c2d2002-07-17 14:10:11 +00005option is supplied at invocation, the shell becomes restricted. A
6restricted shell is used to set up an environment more controlled than
Chet Rameya0c0a002016-09-15 16:59:08 -04007the standard shell. A restricted shell behaves identically to 'bash'
Jari Aalto7117c2d2002-07-17 14:10:11 +00008with the exception that the following are disallowed or not performed:
9
Chet Rameya0c0a002016-09-15 16:59:08 -040010 * Changing directories with the 'cd' builtin.
11 * Setting or unsetting the values of the 'SHELL', 'PATH', 'ENV', or
12 'BASH_ENV' variables.
Jari Aalto7117c2d2002-07-17 14:10:11 +000013 * Specifying command names containing slashes.
Chet Rameya0c0a002016-09-15 16:59:08 -040014 * Specifying a filename containing a slash as an argument to the '.'
Jari Aalto7117c2d2002-07-17 14:10:11 +000015 builtin command.
Chet Rameya0c0a002016-09-15 16:59:08 -040016 * Specifying a filename containing a slash as an argument to the '-p'
17 option to the 'hash' builtin command.
Jari Aalto7117c2d2002-07-17 14:10:11 +000018 * Importing function definitions from the shell environment at
19 startup.
Chet Rameya0c0a002016-09-15 16:59:08 -040020 * Parsing the value of 'SHELLOPTS' from the shell environment at
Jari Aalto7117c2d2002-07-17 14:10:11 +000021 startup.
Chet Rameya0c0a002016-09-15 16:59:08 -040022 * Redirecting output using the '>', '>|', '<>', '>&', '&>', and '>>'
Jari Aalto7117c2d2002-07-17 14:10:11 +000023 redirection operators.
Chet Rameya0c0a002016-09-15 16:59:08 -040024 * Using the 'exec' builtin to replace the shell with another command.
25 * Adding or deleting builtin commands with the '-f' and '-d' options
26 to the 'enable' builtin.
27 * Using the 'enable' builtin command to enable disabled shell
Jari Aalto7117c2d2002-07-17 14:10:11 +000028 builtins.
Chet Rameya0c0a002016-09-15 16:59:08 -040029 * Specifying the '-p' option to the 'command' builtin.
30 * Turning off restricted mode with 'set +r' or 'set +o restricted'.
Jari Aalto7117c2d2002-07-17 14:10:11 +000031
32These restrictions are enforced after any startup files are read.
33
34When a command that is found to be a shell script is executed (*note
Chet Rameya0c0a002016-09-15 16:59:08 -040035Shell Scripts::), 'rbash' turns off any restrictions in the shell
Jari Aalto7117c2d2002-07-17 14:10:11 +000036spawned to execute the script.
37