Safely change the Solaris superuser login shell

Contributor Icon Contributed by qmchenry Date Icon October 5, 2003  
Tag Icon Tagged: Solaris system administration

The default login shell for the Solaris superuser root is /sbin/sh, a statically linked Bourne shell. This shell is not dependent on any other files to run. The usual user shells like /usr/bin/ksh are dynamically linked and are dependent on library files. If the root login shell is changed from /sbin/sh to a non-static shell, root will not be able to log into the system if certain filesystems cannot mount. A simple addition to root’s /.profile will change the shell safely.


To change the root shell to Korn shell at login if the file /usr/bin/ksh exists, add the following lines to the end of the root user’s profile (usually /.profile):

if [ -x /usr/bin/ksh ]; then
SHELL=/usr/bin/ksh
export SHELL
exec /usr/bin/ksh
else
echo /usr/bin/ksh not found using default shell of $SHELL
fi

Make certain that the login shell for root in /etc/passwd is /sbin/sh.

Previous recipe | Next recipe |
 
  • Anonymous
    is during init. Changing init, or shutting down a system while in a non-sh environment can screw up certain apps - most notibly, oracle - which HATES bash. Not sure about ksh.
blog comments powered by Disqus