Sunday, October 19, 2008

Bourne shell may be okay, but I'm a big bash fan myself. So I prefer using doing an "exec bash" after logging in as root. This can be a bit of a pain after a while though, so it would be great to have it automatically use bash. The problem is that some Solaris patching mechanisms may expect Bourne shell to be the default root shell, so if you simple go and change the root shell to bash you could get some unexpected results.

To work around this, edit the /etc/profile (which is the root user's shell profile), and add the snippet of code at the bottom, after all the initialization stuff is finished.

The code just checks who you are, and if you're a particular user, and your shell isn't already bash, then do an "exec bash". If you have a few users that are root you can simply expand the first if statement usingsome "or" logic.

About Me

I've worked in the IT industry for 18 years as a sys admin and network/security admin (and a few other things). Solaris, Linux, and Windows administration; Cisco and Juniper network implementation and design; security analyst; BASIC, C, Assembler, Perl, PHP, COBOL programmer; database admin; backup admin... If it involves a computer, I've probably done it.
Creator of TPM Linux