Operating System - HP-UX
1838677 Members
4767 Online
110128 Solutions
New Discussion

Re: root's shell - need to verify

 

root's shell - need to verify

root - must use /sbin/sh ! correct
checked /etc/passwd - its /usr/bin/sh
question: why does sam only show /usr/bin/
then what shell to use.
it does not allow you to use /sbin/sh

Shouldn't root in /etc/passwd be /sbin/sh


7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: root's shell - need to verify

Yes, root ABSOLUTELY MUST use /sbin/sh as its shell.

Don't trust SAM. You can easily change root's default shell by editing /etc/passwd with the vipw command or by using the usermod command.
Bill Hassell
Honored Contributor

Re: root's shell - need to verify

And one other way to change your shell: chsh will do it without editing /etc/passwd. The reason that it must be /sbin/sh is that this version of the shell uses archived libraries, that is, it self-contained and does not need the shared libraries found in /usr/lib. This is all due to single user mode where /sbin is available for the executable but /usr is not.

As far as SAM, it 'fills-in' /usr/bin/sh for all users. Perhaps it is too friendly and should gray-out the shell choice just for root.


Bill Hassell, sysadmin
James R. Ferguson
Acclaimed Contributor

Re: root's shell - need to verify

Hi Daniel:

To add to this discussion: the use of '/usr/bin/sh' for *non-root* users is preferred over '/sbin/sh' since as noted, the version in '/usr' uses shared libraries rather than archived ones. This allows some sharing of code and reduces the overall, cumulative memory footprint of n+ instantiations.

Regards!

...JRF...
Ralph Grothe
Honored Contributor

Re: root's shell - need to verify

What has been said is all correct and should be general policy for root's shell.
However, if you are adventurous you could get the sources of another shell, say Bash, and build it as a self-contained statically linked binary.
Install the build in /sbin and try it on a test box.
You could always get a working root shell if you booted from an install CD to fix things.
I also wonder if it worked to boot from ISL with something like "hpux -i/sbin/shell", analogous to the init boot param on Linux?

Madness, thy name is system administration
Dennis Handly
Acclaimed Contributor

Re: root's shell - need to verify

>Ralph: if you are adventurous you could get the sources of another shell, say Bash, and build it as a self-contained statically linked binary.

You can't do this on IPF since libc.a is no longer provided.
It is just better to stick with /sbin/sh.

>JRF: the version in /usr uses shared libraries

This also allows you to use alternate locales.

Re: root's shell - need to verify

Thank You, All ! for the info....

Daniel.
Dennis Handly
Acclaimed Contributor

Re: root's shell - need to verify

You haven't assigned any points yet. Please read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33