Overwriting Bash

(Rich) #1

Hi folks.

Just wondering, if I update my El Capitan bash (3.2.57 to 5.0.3), how can I get my system to always view the new bash as default?

I’m setting my iTerm logins to /usr/local/bin/bash (default /bin/bash), and having a shell alias:

alias bash="/usr/local/bin/bash"

Any insight appreciated. Cheers.

0 Likes

(Sean Molenaar) #2

The standard to change this would be https://linux.die.net/man/1/chsh chsh -s /usr/local/bin/bash

0 Likes

(Rich) #3

I never even thought about that. Would changing iTerm2 login do the same?

0 Likes

(Sean Molenaar) #4

Possibly, I think that’s more of an iTerm forum question though.

0 Likes

(Rich) #5

OK, so on OSX, is this permitted, given bash is installed in the OS by default?

0 Likes

(Sean Molenaar) #6

Sure, it’s just a shell.

0 Likes

(Rich) #7

Not worried about it just being a shell, but with OSX barfing.

0 Likes

(Paul M Lambert) #8

You have to both change your login shell with chsh as well as add /usr/local/bin/bash to your /etc/shells file.

I’ve heard it suggested that one “should” make a copy of /usr/local/bin/bash to /private/var/lib/bash5 or somewhere else not modifiable by a non-admin account before using it. I’ve not thought this through as to whether it improves security in a noticeable way, and whether it has other consequences.

If your login shell is not listed in /etc/shells then you will not be able to ssh or otherwise remotely connect, as that is one requirement for a user account to not be treated as a local-only service-specific account, like nobody or daemon or _www.

0 Likes

(Rich) #9

Good to know. Thanks for the post.

0 Likes