[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

8965.0. "Root User Shell of ksh vs sh" by SNOFS1::ELEFTHERIOU () Wed Feb 26 1997 03:24

    Gidday,
    
    I am trying to find a definitive answer to the following question:
    
    "Why shouldn't I change the default root user shell from /bin/sh ?"
    
    For example, I have a customer who insists they want to use the
    /bin/ksh shell as the default shell for root as defined in the
    /etc/passwd file.  They claim this because the ksh has been declared as
    the Posix compliant shell.
    
    I understand if this customers system were set up this way and they
    then experienced any problems (possibly caused by this change), it
    would be difficult to obtain engineering support.
    
    Comments?
    
    Thanks,
    
    Harry E.
    CSC-Sydney
T.RTitleUserPersonal
Name
DateLines
8965.1BIGUN::nessus.cao.dec.com::MayneChurchill's black dogWed Feb 26 1997 16:2135
The first thing I do when I install any system is to change root's shell to 
/bin/ksh and put "set -o emacs" in /.profile. The only side effect I've ever 
seen is that single-user mode (with /bin/sh) doesn't like the "set -o emacs", 
but who cares?

As far as POSIX goes, the top of sh(1) says:

  sh - Shell, the standard command language interpreter

STANDARDS

  Interfaces documented on this reference page conform to industry standards
  as follows:

  sh:  XPG4, XPG4-UNIX, POSIX.2

  Refer to the standards(5) reference page for more information about indus-
  try standards and associated tags.

DESCRIPTION

  [Digital]  Digital UNIX provides two command interpreters with the name sh.
  The XPG4 and POSIX.2 compliant command interpreter sh is available in the
  file /usr/bin/posix/sh and is described in the sh(1p) reference page.  The
  Bourne shell, historically known as sh, is available in the file
  /usr/bin/sh and is described in the sh(1b) reference page.

and the top of sh(1p) says

  sh - Shell, the standard command language interpreter (POSIX Shell)

whereas the only mention of POSIX in the ksh man page is a reference to POSIX 
shell sh(1p).

PJDM
8965.2Thanks but an Answer, not a preferenceSNOFS1::ELEFTHERIOUWed Feb 26 1997 22:4832
    Peter,
    
    Thanks for your reply but it does not answer my question
    satisfactorily.  What I want to hear is any reasoning as to why it is
    either a good or bad idea to have the root users shell something other
    than the default of sh.
    
    Under ULTRIX, a system which did not have sh as the root shell would
    break.  Although there does not seem to be any obviously broken
    behaviour under Digital UNIX, I would like some more proof this is the
    case.
    
    The assumption the /usr filesystem is always available is not a good
    idea, as you yourself point out in single user mode, an error message
    is produced.  Who cares you ask?  I do.  A new customer who is
    umnfamiliar with this system has then been given reason to think
    something is broken.  This I can live without.
    
    Examining the man pages on the various sh references and the setting of
    the BIN_SH environment variable add additional complexities.  For
    example, if the root shell (as defined in the /etc/passwd file) is set
    to /bin/ksh, then it is actually not possible to have a real /bin/sh as
    the behaviour is modified to select the ksh instead.
    
    I would like to be convinced that this situation will not break a
    system either now or later down the track.
    
    Cheers,
    
    Harry E.
     
                                      
8965.3GERUND::WOLFEI'm going to huff, and puff, and blow your house downThu Feb 27 1997 02:008
>    The assumption the /usr filesystem is always available is not a good
>    idea, as you yourself point out in single user mode, an error message
>    is produced.

/bin is actually a softlink to /usr/bin so sh and ksh are on equal 
footing here. I too have always used ksh for root as do the production 
systems at my site.
			Pete
8965.4True.SNOFS1::ELEFTHERIOUThu Feb 27 1997 03:229
        Pete,
    
        True and I do not disagree.  It is interesting to note the system
        startup scripts are flagged as #!/sbin/sh as their invokation
        environment.  /sbin contains static images; the only shell to
        reside in here is sh.
    
        Harry E.
    
8965.5/sbin/sh , /bin/sh and /bin/kshSEPPLT::MARKMark GarrettThu Feb 27 1997 04:1828
Concerning ksh and startup

By the time any startup script is executed bcheckrc has mounted all the file
systems at the start of run level 2 so you can use ksh for startup though I
would what it going the otherway down.

Concerning root's shell in /etc/passwd

When the system is in single user it is not the entry in /etc/passwd that 
determines the shell. /sbin/init forks/execs only one shell that is hard coded
in the binary as /sbin/sh. So do what you like to /etc/passwd even deleted it
and you will still get /sbin/sh


All of the scripts supplied in Digital UNIX will run the script that was
intended by the author as determined by the magic for shell interpreters
and not your current shell it does not matter two hoots what shell root is,
unless the script is written to force shell execution via a fork/exec/kill $$
or you explicetly type $SHELL <scriptname>

	The only thing that really break this is BIN_SH refer to my recent
reply in this notes conference which makes sh run either the real sh or ksh
or the sysV sh. There is a bug in ksh that will cause BIN_SH=xpg4 (run ksh)
to fail setld and probably others. It appears to be fixed in 4.x

	Cheers
		Mark :)

8965.6SEPPLT::MARKMark GarrettThu Feb 27 1997 04:2922
> Examining man pages on the various sh references and the setting of
> the BIN_SH environment variable add additional complexities.  For
> example, if the root shell (as defined in the /etc/passwd file) is set
> to /bin/ksh, then it is actually not possible to have a real /bin/sh as
> the behaviour is modified to select the ksh instead.
>
Your example is wrong. The root shell set to ksh does not result in there
being no real /bin/sh  it is the setting of BIN_SH=xpg4 or BIN_SH=sysv
that looses the real /bin/sh behavour since runing /bin/sh or /sbin/sh
with that variable set tells shell to exec /bin/ksh or the sysV shell. 

> Under ULTRIX, a system which did not have sh as the root shell would
> break.

For those of us that may still run ultrix from time to time could you
please elaberate "would break" "Under ULTRIX" this has not been my 
experience and I have been sysadm on ultrix from 3.0 to 4.5 and as long
as there has been ksh it has been my root shell in /etc/passwd


	Cheers
		Mark :)
8965.7/bin/csh forever...QUARRY::reevesJon Reeves, UNIX compiler groupThu Feb 27 1997 12:363
I've been using /bin/csh as my root interactive shell for longer than I can
remember with no ill effects.  That would seem to imply there's no problem
using ksh the same way.