1830207 Members
2056 Online
109999 Solutions
New Discussion

root's shell

 
SOLVED
Go to solution
Marc Ahrendt
Super Advisor

root's shell

i have always seen /sbin/sh which i think is the POSIX shell. can i use something like /bin/ksh or anything else? only bad thing that comes to mind is that in single user mode /usr is not mounted since most often it is its own file system. any other issues?
hola
9 REPLIES 9
melvyn burnard
Honored Contributor

Re: root's shell

No is the simple answer !
You must use the /sbin/sh
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Jeff Schussele
Honored Contributor
Solution

Re: root's shell

Hi Marc,

AFTER boot you can change it to whatever you please. But it MUST be /sbin/sh in the /etc/passwd entry for root for the reason you pointed out, /usr is not mounted in single-user mode as well link lib issues. The system will refuse to boot if root's entry in the passwd file is anything other than /sbin/sh.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
S.K. Chan
Honored Contributor

Re: root's shell

Keep it at /sbin/sh or you will see this problem as well .. (apart from the "bad shell" error when system boots up).
http://support1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000058669638
A. Clay Stephenson
Acclaimed Contributor

Re: root's shell

Well, in principle, you could use any shell you like BUT you must play but the rules. First, whatever you use must be listed in /etc/shells.

And second, you must have a statically linked version of the shell so that you have a shell when only / is mounted. Having said this, it would be really dumb not to use /sbin/sh (the statically linked version of the POSIX shell).
If it ain't broke, I can fix that.
Michael Tully
Honored Contributor

Re: root's shell

You must use /sbin/sh if you want your system to boot correctly.
Anyone for a Mutiny ?
Marc Ahrendt
Super Advisor

Re: root's shell

with 5 out of 5 pros saying the same thing, i will not play around with anything else but /sbin/sh in /etc/passwd. if another shell is needed/desired for the root user then it will be done on the fly ...thx
hola
Bill Hassell
Honored Contributor

Re: root's shell

The first question I ask is why? You should never login as root except for system administration. And ksh *is* a POSIX shell. HP's POSIX shell is yet another implementation of the POSIX standard, just like bash. (one little nit: /bin doesn't exist, just like Solaris. /bin is a temporary symlink to be used in the transition process--now more than 7 years old. The actual path is: /usr/bin/ksh)

HP's POSIX shell is actually a superset of ksh, with features such as ulimit -a which is not available in ksh. Most users don't want sh as a shell because it (unfortunately) looks like a Bourne shell, which significantly limited compared to POSIX shells. For the average shell user and script writer, the two shells are virtually identical.

One difference that's easy to configure is filename completion and command stack recall. For ksh, the default location is $HOME/.sh_history, but for HP's POSIX shell, there is no default for root so it must be explicitly defined. Since this definition is exactly the same env variable for the POSIX shell, ksh and even bash, the change is easy. Add this to /etc/profile:

export HISTFILE=$HOME/.sh_history

and now all your favorite ksh command stack and and filename completion features will work.


Bill Hassell, sysadmin
W.C. Epperson
Trusted Contributor

Re: root's shell

Bill Hassell, as usual, makes good points. Something we do to avoid tricking up the true "root" environment is create individual uid 0 accounts for sysadmins (aroot, broot, croot, etc.). This allows customization of the logins as well as some measure of accountability via wtmp. We can always su to root if we need to be the real thing.
"I have great faith in fools; self-confidence, my friends call it." --Poe
John Dvorchak
Honored Contributor

Re: root's shell

Once again Bill Hassel is our voice of sanity. I would like to elaborate on his theme of command history. What I do is add this to roots .profile and that way I can keep track of what different people have done as they have su-ed to root:

REAL=`logname`
HISTFILE=.sh_$REAL
HISTSIZE=1000
export HISTFILE HISTSIZE

That way the history file is no longer .sh_history but now there is one history file for each person that su-es to root that looks like .sh_john and .sh_bill etc. By the way the HISTSIZE is number of commands retained, you may want to modify this or eliminate HISTSIZE and take the default.
If it has wheels or a skirt, you can't afford it.