Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 1999 22:21:33 +0100
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        Doug <Doug@gorean.org>
Cc:        "Bill A. K." <billieakay@yahoo.com>, FreeBSD Questions <questions@freebsd.org>
Subject:   Re: roots shell
Message-ID:  <19990819222133.B12658@lithium.scientia.demon.co.uk>
In-Reply-To: <37BB45F2.71B6FFD3@gorean.org>
References:  <002b01bee97f$2a3fdf60$01010101@bopper> <37BB45F2.71B6FFD3@gorean.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Doug wrote:

> 	Yes there is, but it's a bad idea. Several people have already pointed out
> some reasons why. An additional alternative to su -m is to put the
> following in /root/.login:
> 
> [ -x /usr/local/bin/bash] && exec /usr/local/bin/bash
> 
> 	That will start bash for you if it's available, and if it isn't you can
> still log in. 

Wouldn't that fail (i.e. execute bash when it can't) if, say, bash
existed and had the execute bit set, but a library it required on was
trashed? I'd be tempted to try something like

/usr/local/bin/bash --version >/dev/null 2>&1 && exec /usr/local/bin/bash

to make sure it really can be executed, rather than just having the
execute flag set. Or is that just paranoid? But a certain level of
paranoia is a Good Thing, in my opinion.

I just do this, what the hell, it saves me three keypresses :-)

function su() {
        if [[ $# == 0 ]]; then
                command su -m
        else
                command su "$@"
        fi
        chpwd
}

I use zsh now, so I don't know if it knows about "function", "command"
and "su".

-- 
Ben Smithurst            | PGP: 0x99392F7D
ben@scientia.demon.co.uk |   key available from keyservers and
                         |   ben+pgp@scientia.demon.co.uk


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990819222133.B12658>