root /etc/csh

Mel fbsd.questions at rachie.is-a-geek.net
Mon Nov 10 23:49:58 PST 2008


On Tuesday 11 November 2008 00:19:32 Daniel Howard wrote:
> On Mon, Nov 10, 2008 at 1:46 PM, Pieter Donche <Pieter.Donche at ua.ac.be> 
wrote:
> > FreeBSD 7.0 comes with the user root with start up shell /bin/csh
> > As normal user I use bash (/usr/local/bin/bash installed)
> > I would prefer to have bash also when working as root (su).
> > Of course I can do
> > # bash
> > [root ~]# or I could change the startup shell in /etc/passwd, but would
> > that be a wise
> > thing to do or not?
>
> If your system is having a bad time, falling back to statically-linked
> /bin/csh

/bin/csh is not statically linked. /rescue/csh is.

> can help you out in a jam, whereas pointing way off to 
> /usr/local/bin/bash could spell trouble if say, you can not mount
> /usr.

More likely trouble scenario is gettext library version bump. However, bash 
can be statically compiled by the port and you can also set $PREFIX to /, so 
it gets installed as /bin/bash.
That said, you should before you change root's shell have dealt with a broken 
root shell a few times, to be able to ascertain whether this extra problem is 
something you want to deal with, at the times you already have a more 
pressing problem to solve.

>
> As prad pointed out, you can "su -m".  I myself prefer "sudo -s".

Unfortunately, sudo -i is not a substitute for su -l, as sudo tries to be more 
secure then it should be, cleaning the environment, preserving PATH, rather 
then taking the correct values from /etc/login.conf. Most notably tilde and 
dollar sign expansion, which are great *shell-independant* features:
$ grep setenv /etc/login.conf
        :setenv=MAIL=/var/mail/$,BLOCKSIZE=M,FTP_PASSIVE_MODE=YES,PACKAGES=/var/pkg/7-stable,PKG_PATH=/var/pkg/7-stable\c.
\c/home/$/packages,CCACHE_DIR=/var/db/ccache/$:\

$ echo {$CCACHE_DIR:=No}
/var/db/ccache/mel

$ echo $MAIL
/var/mail/mel

$ sudo -c root -i
# echo ${CCACHE_DIR:=No}
No
# echo $MAIL
/var/mail/mel


-- 
Mel

Problem with today's modular software: they start with the modules
    and never get to the software part.


More information about the freebsd-questions mailing list