I was learning about Common shell programs.

When I run cat /etc/shells, it shows:

# /etc/shells: valid login shells

What is /bin/rbash here? Is it used in scripting?

  • 6
    Which part of man rbash is unclear? Jan 6, 2017 at 10:55
  • 1
    @StigHemmer. I didn't do it. man rbash also gives me detail information. Thanks.
    – d a i s y
    Jan 6, 2017 at 11:05
  • 3
    Reading the man page should always be your first attempt to understand a tool. You should also read it on the machine where it appears to ensure you're reading about the correct version.
    – user399352
    Jan 6, 2017 at 19:25

2 Answers 2


rbash is a restricted (reduced capabillities) version of bash. See this article: https://en.wikipedia.org/wiki/Restricted_shell

From the article:

The following operations are not permitted in a restricted shell:

changing directory
specifying absolute pathnames or names containing a slash
setting the PATH or SHELL variable
redirection of output

bash adds further restrictions, including:

limitations on function definitions
limitations on the use of slash-ed filenames in bash builtins

Restrictions in the restricted Korn shell are much the same as those in the restricted Bourne shell.


From wikipedia

The restricted shell is a Unix shell that restricts some of the capabilities available to an interactive user session, or to a shell script, running within it. It is intended to provide an additional layer of security, but is insufficient to allow execution of entirely untrusted software. A restricted mode operation is found in the original Bourne shell[1] and its later counterpart bash,[2] and in the Korn shell.[3] In some cases a restricted shell is used in conjunction with a chroot jail, in a further attempt to limit access to the system as a whole.

See Soren A's answer for the limitations that apply to restricted shells.

You can run bash in restricted mode

bash -r
bash --restricted

On my system:

$ file /bin/rbash
/bin/rbash: symbolic link to bash

So if I run /bin/rbash, I am running bash


It suffices to create a link named rbash pointing directly to bash. Though this invokes bash directly, without the -r or --restricted options, bash does recognize that it was invoked through rbash and it does come up as a restricted shell.

As you can easily test:

zanna@monster:~$ rbash
zanna@monster:~$ cd playground
rbash: cd: restricted
  • 1
    Seems many restriction. Then how is it helpful? Does it use in scripting?
    – d a i s y
    Jan 6, 2017 at 10:09
  • 3
    It could be set as default shell for a user you want to trap in a particular directory, for example @passa
    – Zanna
    Jan 6, 2017 at 10:13
  • 2
    @passa that's not scripting, and restricted shells are singularly useless for scripting. Since you know, or can determine, what actions are done in a script, there's no point to using a restricted shell for scripting.
    – muru
    Jan 6, 2017 at 10:32
  • @muru Okay. So this could be used for purpose that zanna said in her comment.
    – d a i s y
    Jan 6, 2017 at 10:34
  • 1
    This is helpful to a system administrator because it can prevent other users from performing dangerous tasks. It is somewhat less useful to the end user.
    – user399352
    Jan 6, 2017 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.