Professional Web Applications Themes

Is it safe to change root's shell to csh in Solaris 9? - Sun Solaris

I've read some posts which seem to indicate the prohibition against a sane person changing root's shell no longer apply in the more recent versions of Solaris (8 & up). I'm trying to find opinions to confirm or deny this. Our hosting facility wants to change the root shell of our Solaris servers running Solaris 9 to csh. I want to know if anyone thinks this is a bad idea, and why. Please include URL references to any official Sun doentation that supports or recommends against this practice if you know them. Thanks, Mike...

  1. #1

    Default Is it safe to change root's shell to csh in Solaris 9?

    I've read some posts which seem to indicate the prohibition against a
    sane person changing root's shell no longer apply in the more recent
    versions of Solaris (8 & up). I'm trying to find opinions to confirm
    or deny this.

    Our hosting facility wants to change the root shell of our Solaris
    servers running Solaris 9 to csh. I want to know if anyone thinks this
    is a bad idea, and why. Please include URL references to any official
    Sun doentation that supports or recommends against this practice if
    you know them.

    Thanks,

    Mike
    mjcsfo Guest

  2. #2

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    On Wed, 01 Oct 2003 13:16:40 -0700, mjcsfo wrote:
     

    http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=finfodoc/40773

    Dave Guest

  3. #3

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    In article <com>,
    Dave Uhring <com> writes: 
    >
    > http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=finfodoc/40773[/ref]

    I'm not totally happy with their example testing if it's ok before
    running it within /.profile. If I were to do it (and I wouldn't), I'd
    rather do it by ending /.profile with something like:

    if [ -x /bin/csh ] && csh -c : >/dev/null 2>&1
    then
    SHELL=/bin/csh;export SHELL
    exec ${SHELL}
    fi

    except that in the case of csh (which I personally _hate_), that would
    result in /.login not being run. (that wouldn't be an issue if
    one were running ksh instead of csh, since both either ksh or sh would've
    run .profile, although if one were running ksh, one might want to set ENV
    to /.kshrc (or whatever) before exec'ing ksh)

    --
    mailto:smart.net http://www.smart.net/~rlhamil
    Richard Guest

  4. #4

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    On 1 Oct 2003, mjcsfo wrote:
     

    Even in Solaris 9, there are still reasons not to change root's
    shell, both technical and non-technical. Prior to Solaris 9,
    if root's shell was wrongly specified in /etc/passwd, you would
    not be able to log in as root, unless you had somehting else you
    could boot from. Solaris 9 runs /sbin/sh if root's shell is
    invalid.

    I would still recommend against having a dynamically linked root
    shell, but Solaris 10 will be doing away with a statically linked
    root shell, so I guess even that point is moot (although I still
    think that that's a bad idea).
     

    Get a different hosting facility. If they're your servers,
    YOU should specifiy what shell they use. Not to mention that
    csh is about the worst shell they could chose anyway! (What
    are they, BSD weenies?)
     

    AFAIK, there is no official Sun doentation for or
    against this practice.

    I would say that any shell they use should be on the root
    partition. I think that's something both sides of the
    "changing root's shell" debate would agree on!

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: http://www.rite-online.net

    Rich Guest

  5. #5

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    On Thu, 02 Oct 2003 18:39:42 +0000, Rich Teer wrote:

     

    Not entirely moot. All the library dependencies for /sbin/sh reside on
    the / partition.
     

    Sun apparently agrees with you.

    Dave Guest

  6. #6

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    Rich Teer <com> writes:
     
    >
    > Even in Solaris 9, there are still reasons not to change root's
    > shell, both technical and non-technical. Prior to Solaris 9, if
    > root's shell was wrongly specified in /etc/passwd, you would not be
    > able to log in as root, unless you had somehting else you could boot
    > from. Solaris 9 runs /sbin/sh if root's shell is invalid.
    >
    > I would still recommend against having a dynamically linked root
    > shell, but Solaris 10 will be doing away with a statically linked
    > root shell, so I guess even that point is moot (although I still
    > think that that's a bad idea).[/ref]

    Dynamically linked or not, IMHO the shell root gets in Solaris is so
    braindead that sane people will change it somehow. The only question
    is how. Typing 'exec ksh' on the command line is probably the best
    way, but it's a pain in the butt when you have to su a lot because you
    need to get things done. Changing it to csh is a solution that's worse
    than the problem.
     
    >
    > Get a different hosting facility. If they're your servers,
    > YOU should specifiy what shell they use.[/ref]

    Yes...
     
    >
    > AFAIK, there is no official Sun doentation for or
    > against this practice.[/ref]

    There is some doentation on it though:

    http://www.grymoire.com/Unix/CshTop10.txt
    http://www.grymoire.com/Unix/Csh.html#uh-0
    http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

    I personally don't buy the argument that csh is a better interactive
    shell, but that's just me.

    Joe
    joe@invalid.address Guest

  7. #7

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    On Thu, 2 Oct 2003, Dave Uhring wrote:
     
    >
    > Not entirely moot. All the library dependencies for /sbin/sh reside on
    > the / partition.[/ref]

    Well, "moot" does mean "open to argument; debatable", which
    was my point. Not that I'm advocating it!

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: http://www.rite-online.net

    Rich Guest

  8. #8

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    On Thu, 2 Oct 2003 address wrote:
     

    Agreed - but strictly speaking, that's not changing root's shell.
    I have absolutely no argument against people invoking their shell
    of choice once they've logged in (leaving root's shell the same as
    the day the system was installed), just against people changing
    root's shell in /etc/passwd.
     

    Agreed; that's what cunning .profile scripts are for. :-)
     

    Csh does has one thing going for it: command history. Of
    course, there are plenty of other, better shells, that also
    have command history.

    Using csh for scripting is just demented, IMHO.

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: http://www.rite-online.net

    Rich Guest

  9. #9

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    In article <address>,
    address writes: 
    >>
    >> Even in Solaris 9, there are still reasons not to change root's
    >> shell, both technical and non-technical. Prior to Solaris 9, if
    >> root's shell was wrongly specified in /etc/passwd, you would not be
    >> able to log in as root, unless you had somehting else you could boot
    >> from. Solaris 9 runs /sbin/sh if root's shell is invalid.
    >>
    >> I would still recommend against having a dynamically linked root
    >> shell, but Solaris 10 will be doing away with a statically linked
    >> root shell, so I guess even that point is moot (although I still
    >> think that that's a bad idea).[/ref]
    >
    > Dynamically linked or not, IMHO the shell root gets in Solaris is so
    > braindead that sane people will change it somehow. The only question
    > is how. Typing 'exec ksh' on the command line is probably the best
    > way, but it's a pain in the butt when you have to su a lot because you
    > need to get things done. Changing it to csh is a solution that's worse
    > than the problem.[/ref]

    You shouldn't be spending enough time logged in (directly) as root for
    it to matter how repulsive root's shell is. Indeed, the more repulsive
    (and the more brain-dead) it is, the better; less excuse to stay logged
    in as root, and less to go wrong, respectively.

    You can avoid typing exec ksh if you do that as part of the su command,
    i.e.

    su root -c 'exec ksh'

    Since that too is tedious, you could define a function or alias for
    your regular shell that does it for you. For example (ksh):

    function suk {
    typeset dash user

    if [ x"${1}" = x"-" ]; then
    dash="-"
    shift
    fi

    if [ -n "${1}" ]; then
    user="${1}"
    shift
    else
    user=root
    fi

    if [ $# -gt 0 ]; then
    echo "usage: $0 [-] [user]" >&2
    return 1
    fi

    su ${dash} "${user}" -c 'exec ksh'
    }


    You could also modify such a function to take care of little annoyances
    like resetting HISTFILE (ksh history file) before exec'ing ksh:

    su ${dash} "${user}" -c "exec env HISTFILE=$(echo ~${user}/.sh_history) ksh"


    Heck, if you had a suitable .au file, you could even make it quack like a
    duck:

    audioplay AFLAK.au


    :-)




    --
    mailto:smart.net http://www.smart.net/~rlhamil
    Richard Guest

  10. #10

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    Richard L. Hamilton wrote: 

    I agree with not staying logged in as root for too long.

    However, I use ksh as root because it helps me avoid some
    potentially damaging mistakes. I can type "rm foo" and then
    hit escape-* (in vi-mode) to have it change the command line
    to read "rm foo.txt foo.txt.bak". To me, this is a bit
    safer than typing "rm foo*".

    - Logan

    Logan Guest

  11. #11

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    Rich Teer wrote: 
    >>
    >>Not entirely moot. All the library dependencies for /sbin/sh reside on
    >>the / partition.[/ref]
    >
    >
    > Well, "moot" does mean "open to argument; debatable", which
    > was my point. Not that I'm advocating it![/ref]


    Depends on which sense you mean. "Moot" can mean "open to debate" or
    "not relevant";
     

    ISTR in UK usage meaning 1 is more common, while in US usage meaning 2b
    is the one more often understood.

    Two nations separated by a single language...

    --
    Tony



    Tony Guest

  12. #12

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    Tony Walton <com> writes:
     
    >
    >ISTR in UK usage meaning 1 is more common, while in US usage meaning 2b
    >is the one more often understood.[/ref]

    In the UK, 2 is virtually non-existant. I've never heard that usage.
    Chambers 20th C dictionary defines moot point as "an undecided or
    disputed point".
     

    Quite. Thinking back, that explains quite a lot of things.

    Pete

    --
    __________________________________________________ __________________
    Pete Young org Remove dot. to reply
    "Just another crouton, floating on the bouillabaisse of life"

    Pete Guest

  13. #13

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    Pete Young wrote: 
    >>
    >>ISTR in UK usage meaning 1 is more common, while in US usage meaning 2b
    >>is the one more often understood.[/ref]
    >
    >
    > In the UK, 2 is virtually non-existant. I've never heard that usage.
    > Chambers 20th C dictionary defines moot point as "an undecided or
    > disputed point".
    >

    >
    >
    > Quite. Thinking back, that explains quite a lot of things.
    >
    > Pete
    >[/ref]

    Although off-topic, I can't help interjecting another example of
    British vs. US usage: 'to table'.

    In the US, to table a discussion is to put it aside, ignore it for now.
    The British meaning is exactly the opposite.


    --
    Bill Wyatt (harvard.edu) "remove this" for email
    Smithsonian Astrophysical Observatory (Cambridge, MA, USA)

    WilliamREMOVEWyattTHIS Guest

  14. #14

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    On Fri, 3 Oct 2003, Tony Walton wrote:
     

    That's true.
     [/ref]

    Your quoting an AMERICAN source for the meaning of an
    English word? That makes it invalid from the word go! :-)
    (FWIW, I used the Shorter Oxford English Dictionary; can't
    afford the 20 volume set of the complete OED...)
     

    I think you're right.
     

    Indeed! Now, if the Merkins would only learn how to spell
    words with a "u" in them, or a double "l", or that end in
    "ise", life would be good. :-)

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: http://www.rite-online.net

    Rich Guest

  15. #15

    Default Re: Is it safe to change root's shell to csh in Solaris 9?

    In article <Pine.GSO.4.44.0310030927500.12276-100000zaphod>,
    Rich Teer <com> writes: 
    >
    > That's true.
    > [/ref]
    >
    > Your quoting an AMERICAN source for the meaning of an
    > English word? That makes it invalid from the word go! :-)
    > (FWIW, I used the Shorter Oxford English Dictionary; can't
    > afford the 20 volume set of the complete OED...)[/ref]

    Hmm - if you need something looked up lemme know : >
    My G.O.D. is a little long in the tooth though - bought
    it back in 1975...

    Guest

Similar Threads

  1. Replies: 0
    Last Post: October 27th, 12:58 AM
  2. excuting a shell command in linux as root
    By Michael in forum PHP Development
    Replies: 2
    Last Post: October 8th, 10:26 AM
  3. Non-root users can't print on Solaris 9
    By Daniel in forum Sun Solaris
    Replies: 7
    Last Post: October 2nd, 06:10 PM
  4. run following shell error on solaris but OK on RedHat, why????
    By Rick Ng Chi Wah in forum Sun Solaris
    Replies: 4
    Last Post: August 14th, 08:43 AM
  5. automatic root shell initialization
    By Bob Proulx in forum Debian
    Replies: 1
    Last Post: July 1st, 12:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139