Open Source Software and Linux

Feb 6 2009   2:49PM GMT

Solaris 10, ksh and root

John Little Profile: Xjlittle

Like many people I have the question of, on Solaris 10, can I set the default root shell to ksh. After some study and research apparently it is ok to do this. The default shell for root is /sbin/sh. For those of us that use Linux this is not a symlink to bash but a static binary of the Bourne Shell.

Solaris versions previous to 10 had the Bourne Shell statically linked so that in case of a crash root would have access to a shell. This implies that certain directories were not mounted when booting into a ‘rescue’ mode, namely /usr.

With version 10 of Solaris, Sun has dynamically linked linked the Bourne Shell. This means that it does in fact now use shared libraries. This also implies that since other shells use shared libraries that it is ok to use the shell of your choice.

Sun has also built code into the OS that if for some reason the shell that is designated as the default is not accessible it will fall back to /sbin/sh. This resolves the problem of changing the default shell and still being able to sleep at night. Still experience says this is new and different, do I really want to rely on this new style?

If you are like me, a devout coward regarding such things, then you probably are reluctant to go this route. Because of my cowardice I have reached a compromise that works well, at least for me.

First I created a /root home directory and changed the home directory in /etc/passwd to reflect this. The directory mode is set to 700 and user/group ownership is set to root.

I then copied the contents of /etc/skel, including the hidden file .profile, into root’s home directory. After that I edited the .profile file so that it contains the following:

SHELL=/bin/ksh
export SHELL
HISTFILE=~/.history
HISTSIZE=1000

This gives me a login and working shell of ksh while leaving the default shell in /etc/passwd to /sbin/sh.

hth.

John

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: