Operating System - HP-UX
1837936 Members
3254 Online
110124 Solutions
New Discussion

Re: Feedback using bash shell for root

 
Adel Habashy_1
New Member

Feedback using bash shell for root

We are thinking to use bash in our mixed unix environment as the standard root login shell.
bourne shell is hpux default and if troubles happen, /sbin/sh has no dependancies. bash has dependency on few libraries under a different file system /usr/lib but I mirror all the OS file systems which covers this point. Does anybody sees any concern or negative outcome when changing the root shell to bash? I certainly appreciate any feedback.
12 REPLIES 12
James R. Ferguson
Acclaimed Contributor

Re: Feedback using bash shell for root

Hi:

NO, don't change the default root shell!

Root's default shell must be the statically linked Posix shell found in '/sbin/sh'. In this fashion, everything is available even before shells in '/usr' with dynamic libraries are available when '/usr' is finally mounted.

Regards!

...JRF...
Patrick Wallek
Honored Contributor

Re: Feedback using bash shell for root

ABSOLUTELY POSITIVELY DO NOT CHANGE THE DEFAULT SHELL IN /etc/passwd!!!!!!

If you do that you will almost certainly break things, and it is possible that the machine may have problems booting.

There are lots of things that are very dependent on the '/sbin/sh' for root.

You are actually incorrect in saying that the bourne shell is the default. the 'sh' shell in HP-UX is the POSIX shell.

Also, if you change the default in /etc/passwd, you may not be able to effectively use single-user mode. When booting to single-user mode, you do NOT have any file systems mounted, other than '/', so you would NOT have any of the dependencies for bash. That's the purpose of '/sbin/' executables. They are all statically linked, so they don't require any additional libraries from /usr/lib or anywhere else.

My recommendation: DO NOT CHANGE ANYTHING. ESPECIALLY DO NOT CHANGE /etc/passwd. Learn the POSIX shell. Do a 'man sh-posix' and read up on the shell. You'll probably find you can do as much with POSIX as with bash.

If you must use bash, login as root and then do an 'exec bash' to start the bash shell for that particular session.
Rick Garland
Honored Contributor

Re: Feedback using bash shell for root

I add to the chorus - do not change root shell

You will most likely have booting trouble. You will need to boot into single user to fix the /etc/passwd entry and change it back to /bin/sh

If you want root to have bash, put it root .profile


Pete Randall
Outstanding Contributor

Re: Feedback using bash shell for root

I think you'll find that the response is going to be unanimous:

DO NOT CHANGE ROOT'S SHELL!!!!!


Pete

Pete
Peter Nikitka
Honored Contributor

Re: Feedback using bash shell for root

Hi,

I really would NOT change the shell for root.
But you can setup an environment for 'bash' (or any other shell like tcsh as we have on solaris).
Check the conditions and if positive, start your customized shell (prob. via exec) in ~root/.profile:
...
case $- in
*i*) [ -x /usr/bin/bash ] && exec /usr/bin/bash ;;
esac
...

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Rick Garland
Honored Contributor

Re: Feedback using bash shell for root

/bin/sh -- /sbin/sh

My typo.

A. Clay Stephenson
Acclaimed Contributor

Re: Feedback using bash shell for root

The only way this makes any sense is if you create a statically linked version from source --- and even then it's dumb.

The major problem is that any rc scripts which must execute before /usr is mounted are dogmeat without a statically linked shell.

Moreover, I am not a big fan of bash:

try this:

echo "one two three" | read A B C
echo "A = ${A}"
echo "B = ${B}"
echo "C = ${C}"

On most versions of bash this is a showstopper because it is such a useful construct that works perfectly under ksh or the POSIX shell.
If it ain't broke, I can fix that.
Kent Ostby
Honored Contributor

Re: Feedback using bash shell for root

Pre-11.00, you could do this on hp-ux without problems.

However, since 11.00, you will get a very specific error message at boot up if you try this:

init: warning: bad shell for root

or sometimes:

"No Shell".
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Bill Hassell
Honored Contributor

Re: Feedback using bash shell for root

And finally, have you looked at the differences between HP's POSIX sh and bash? The HP sh shell, ksh and bash are all based on ksh and the POSIX standard. So you would have to look hard to find important differences. Virtually all the shell built-ins are there, most of the options are the same, variable expansion, regular expressions are all the same.

It is very difficult to locate the Bourne shell (/usr/old/bin/sh). Try using the HP POSIX shell and you may never go back to bash. And of course, if you want bash because root is constantly being used in this system, the question is: why? root is for system maintenance, not for general usage. Your system be much more stable if you limit root access.


Bill Hassell, sysadmin
Adel Habashy_1
New Member

Re: Feedback using bash shell for root

Thanks a lot to everyone who responded. I didnâ t do a good job in presenting my question. I am not thinking to change the default shell in the password file. I still remember a long night several years ago during which I struggled to reboot a production server and it ended up that somebody changed the default shell to korn. As for posix shell, I use it for long years and personally like it. Thanks Patrick for catching my typo about bourne. Sorry I was thinking Solaris then.
I donâ t expect to be able to boot at all in single-user if bash is the default shell since several libraries will be missing.
What I am thinking to do is: 1) Leave the /etc/passwd default shell as POSIX. 2) Add a line at the â endâ of the root profile that will execute bash.
This way, in the normal login the root will be switching to bash. In single-user mode, I expect to be able to boot but get an error on â exec bashâ line and then keep working with the statically linked POSIX.
The reason for using bash is to accommodate the other admins who use bash especially in Linux and may have to work on HPUX in an emergency situation.
Bill Hassell
Honored Contributor

Re: Feedback using bash shell for root

Since bash and ksh and POSIX-sh are so similar, I would be concerned about letting a user have root access that doesn't know that there are other shells in the real world. Most bash users tell me that they can't tell the difference until they play with arrow keys and other user interface crutches. To me, allowing such a user to have root is asking for major problems since these users apparently can't swicth gears on another system. I would be very concerned about the major differences in handling volume managers, devicefiles, logfile locations, etc, causing problems with a novice sysadmin.


Bill Hassell, sysadmin
Torsten.
Acclaimed Contributor

Re: Feedback using bash shell for root

In a *really* emergency situation every working shell prompt will be appreciated
;-)

So I would not change the default.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!