Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just noticed that on OS X 10.6.4 root's shell is set to /bin/sh. Is there a security issue or something with running Bash?

share|improve this question
up vote 2 down vote accepted

I believe that for Unix compatibility reasons, the default root shell is /bin/sh.


At one point, /bin/sh was a zsh shell, I believe. Apple changed it to bash because zsh wasn't POSIX compliant or somesuch.


The Makefile sourcecode, showing that /bin/sh is built from bash source.

EDIT #2:

Bored, I checked. It looks like Mac OS X 10.1.5 was the last version to use zsh for /bin/sh. It was changed to bash in 10.2.

share|improve this answer

Ubuntu uses dash as the default system shell for speed instead of sh. I guess if it is indeed sh, then it is probably the same reason.

There are good reasons here why bash is not really the best choice as the default system shell:

share|improve this answer
The myriad features in Bash need facilities to initialize them and code to support them. On Ubuntu Lucid x86, both bash and dash are dynamically linked, stripped ELF binaries, but bash at 800kB is ten times the size of dash. – msw Jun 18 '10 at 16:03

Isn't /bin/sh Bash?

Do a 'ls -lisa' in /bin. Then do a './sh -version' in the directory and sh will identify itself as the GNU bash.

share|improve this answer
According to stat -f "%N: %i" /bin/sh /bin/bash, they aren't hardlinks of each other and an md5sum of the two files produces different checksums. Even if /bin/sh were a symlink or hardlink to /bin/bash, Bash checks the name it was run under and activates a compatibility mode if the name is sh. – Chas. Owens Jun 18 '10 at 16:01
@Chas. Andrew is correct, they are the same. Proof: – ghoppe Jun 18 '10 at 16:22
@ghoppe explain the different md5sums. And the fact that running set -o vi turns off tab completion when run under sh, but not bash. Saying sh is bash ignores the fact that they behave differently, which is the point of this question. Why is OS X using sh, and is it unsafe to change it use bash. I don't doubt that they are both built from the same source, but they are not the same. – Chas. Owens Jun 18 '10 at 18:09
@Chas if you check the sourcecode I linked, you'll see that bin/sh is built with $(Extra_Configure_Flags) --enable-strict-posix-default I'm pretty certain this is why the md5 checksums are different and they exhibit slightly different behaviour. I'm not enough of a unix geek to know why set - o vi behaves as it does, but I did find this list of POSIX mode differences: – ghoppe Jun 21 '10 at 14:18

Setting root's login/interactive shell to /bin/bash has no affect on shell scripts that have #!/bin/sh as their shebang line. For those scripts whatever file acts as /bin/sh whether it's a standalone executable or a symlink or hard link will be used to interpret that script. Likewise for scripts run from the command line in this manner: sh script.

It's perfectly fine to set the root user's interactive shell to be /bin/bash.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .