← 返回命令列表

Linux command

rbash 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start restricted shell

rbash

Run command in restricted mode

rbash -c "[command]"

Run script restricted

rbash [script.sh]

说明

rbash is a restricted mode of the Bash shell that limits user actions to prevent unauthorized system access. When invoked as rbash (or via bash -r), it disables directory changes with cd, prevents modification of PATH, SHELL, ENV, and BASH_ENV variables, and blocks output redirection with >, >>, and related operators. The restrictions also prevent commands containing slashes (blocking direct paths like /bin/command), use of the exec builtin, and importing of functions from the environment. This makes it useful for providing limited shell access to untrusted users when combined with a carefully controlled PATH containing only approved commands.

参数

-c _STRING_
Execute command string.
-i
Interactive mode.
-l
Login shell.
-r
Restricted mode (default).

FAQ

What is the rbash command used for?

rbash is a restricted mode of the Bash shell that limits user actions to prevent unauthorized system access. When invoked as rbash (or via bash -r), it disables directory changes with cd, prevents modification of PATH, SHELL, ENV, and BASH_ENV variables, and blocks output redirection with >, >>, and related operators. The restrictions also prevent commands containing slashes (blocking direct paths like /bin/command), use of the exec builtin, and importing of functions from the environment. This makes it useful for providing limited shell access to untrusted users when combined with a carefully controlled PATH containing only approved commands.

How do I run a basic rbash example?

Run `rbash` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c _STRING_ do in rbash?

Execute command string.