How do I make ksh or csh be the login shell for root?

How do I make ksh or csh be the login shell for root?



Root's shell is /sbin/sh.
Don't just insert a 'c' before "sh" as previously, as that would
look for /sbin/csh, which doesn't exist. Don't just change it to
/bin/csh, since that's really /usr/bin/csh, which is dynamically
linked, because:

1) /usr may not be mounted initially, and then
you're in deep (the shared libraries are in /usr!), and

2) There is code in the startup scripts that assumes that
everything critical is in /etc/lib, not /usr/lib.
Approach with caution!


Whenever you change root's shell, make sure you do it using
vipw or "passwd -e". Both programs will check for a valid
(in the sense of /etc/shells) file.


Safer bet - have an alternate root account, like "rootcsh",
with uid 0, and /bin/csh as its shell. Put it after root's entry in
the passwd file. Only drawback: you now have to remember to
change all of root's passwords at the same time.


Third bet - in root's .profile, check if /usr is mounted and, if so,
exec /bin/ksh or whatever.


An even better bet - leave root's shell alone, and use the
sudo command for doing things as root.





Home
FAQ