From owner-freebsd-questions@FreeBSD.ORG Tue Nov 11 07:49:58 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25E091065679 for ; Tue, 11 Nov 2008 07:49:58 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from mail.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id DAA308FC18 for ; Tue, 11 Nov 2008 07:49:57 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from localhost (mail.rachie.is-a-geek.net [192.168.2.101]) by mail.rachie.is-a-geek.net (Postfix) with ESMTP id 0C4C5AFCF54; Mon, 10 Nov 2008 22:49:57 -0900 (AKST) From: Mel To: freebsd-questions@freebsd.org Date: Tue, 11 Nov 2008 08:49:55 +0100 User-Agent: KMail/1.9.7 References: <20081110110805.GK1302@obspm.fr> <2a5241e00811101519k505dcaabvd59fecc19d283bc3@mail.gmail.com> In-Reply-To: <2a5241e00811101519k505dcaabvd59fecc19d283bc3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811110849.56028.fbsd.questions@rachie.is-a-geek.net> Cc: Daniel Howard , Pieter Donche Subject: Re: root /etc/csh X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2008 07:49:58 -0000 On Tuesday 11 November 2008 00:19:32 Daniel Howard wrote: > On Mon, Nov 10, 2008 at 1:46 PM, Pieter Donche 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.