[SPARCbook] Shell?

Sunder sunder at sunder.net
Mon Jan 24 11:26:05 CST 2000


Jeff wrote:
> 
> Just wondering how I can SAFELY change my shell from sh to bash for
> root.  This isn't on my sparcbook, but there was a big discussion on
> this a week ago or so.

Under solaris there's no chfn or chsh, so you'll have to login as root to
change your own shell...  Under OpenBSD at least there's chsh -s shellpath
which will do what you'd want.  So the only way to do it is to run vi
/etc/passwd, or if you prefer vipw.

I'd say, do this while under X, and don't log out.  So, you'd login as root,
open a terminal, vipw, then telnet or ssh to localhost and try to login as
root.  Opening another Xterm (or DtTerm) should also be a good test.

Generally it's a very bad idea to change to bash because bash is generally
dynamically linked to the various libraries in /usr.  The problem is that if
you aren't able to mount /usr for whatever reason, you won't be able to login
as root to fix the problem.  

This is why root's login shell isn't /bin/sh, but /sbin/sh because /sbin/sh is
a statically linked version.

So there are three ways to do this safely:

1. Create an alternate root account (i.e.: toor - root backwards) which has
/usr/local/bin/bash as its shell and use that)

2. Build your own version of a statically linked bash, dump it in /sbin and
make that root's shell.

3. Put something like this at the end of your .profile:

 if  [ -f /usr/local/bin/bash ]; then; exec /usr/local/bin/bash; fi

This will see if /usr/local/bin/bash exists, and if it does, switch to it.  You
might have to experiment a bit more with this, so try it on a regular account
before you do it to root, but it's a starting point.

I just wish Sun got off their asses and officially supported bash and tcsh. :)
ksh is nice, but, way outdated.

-- 
---------------------------- Kaos Keraunos Kybernetos -------------------- 
 + ^ +  Sunder              "Only someone completely distrustful of   /|\ 
  \|/   sunder at sunder.net    all government would be opposed to what /\|/\ 
<--*--> -------------------- we are doing with surveillance cameras" \/|\/ 
  /|\   You're on the air.   -- NYC Police Commish H. Safir.          \|/ 
 + v +  Say 'Hi' to Echelon  "Privacy is an 'antisocial act'" - The FedZ.
---------------------------- http://www.sunder.net -----------------------
I love the smell of Malathion in the morning, it smells like brain cancer.






More information about the SPARCBook mailing list