Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 May 1999 11:11:24 -0700 (PDT)
From:      Annelise Anderson <andrsn@andrsn.stanford.edu>
To:        Pete Vanderburgh <peterv@verio.net>
Cc:        "James A. Mutter" <jm7996@devrycols.edu>, Alfred Perlstein <bright@rush.net>, ". ." <corinthian420@hotmail.com>, freebsd-questions@FreeBSD.ORG
Subject:   Re: why we don't mess with root's shell: Re: Need help withRoot shell?
Message-ID:  <Pine.BSF.3.96.990527101824.18910B-100000@andrsn.stanford.edu>
In-Reply-To: <374D79CD.969EA9AC@verio.net>

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



> > If noone's mentioned this yet, /bin/bash is a "linux only" thing.

But bash is not a linux only thing.  Bash is a superset of sh and
an excellent shell.

> Just for the record, I am currently running FreeBSD 3.1 Stable on a
> Pentium 133, using IceWm for X-Windows, and yes, my root shell is bash.
> 
> I am new at this as well, and had some help installing FreeBSD, so I'm
> not precisely certain about how I set up the bash configuration.  But it
> does work, and isn't giving me problems.
> 
> If this setup *is* unusual (and it sounds like it is?) I guess I should
> live it up now; I may not be able to do this again?
> 
> Just my $0.02.

It's not unusual, and you can do it again.

When bash (or tsch or zsh and probably other shells) are installed
from the ports collection, FreeBSD puts the binary in /usr/local/bin
and edits /etc/shells to include the shell as an acceptable
login shell, by putting the line /usr/local/bin/bash (or whatever)
in this file.  Only recent versions of FreeBSD do this setup
automatically.

chsh or vipw is then used to change the user's shell in the
password file to /usr/local/bin/bash.  These paths have to be
correct, and getting them wrong is the major reason for trouble.

FreeBSD ships with two shells in /bin, sh and csh, statically
compiled so they will run when /usr is not mounted (when the
system is in trouble).  But sh is the default shell for a boot
in single user mode, and will be there for root even if it's not
root's shell.  Root's default shell (for a login as root) is
csh.

FreeBSD ships with a second ID 0 account, toor, whose default
shell is sh, but initially toor has * in the password field.
I change root's shell to be the same as my user shell.  But
first I give toor a password and leave toor's shell as sh, put
toor in the wheel group in /etc/group, and make sure I can log 
in with it and use it. Sometimes I create a user whose default
shell is sh who's in the wheel group, because I've had trouble
running some commands (chroot, for example) from root with the
zsh shell. 

But you can keep your user login shell when you become root anyway 
by using su -m, which maintains most of the existing environment.

You could statically compile bash (or your favorite shell) so
that it would not depend on libraries in the /usr hierarchy, but
would be available in single-user mode.  Whether this more
memory-hungry version would get called at times would (I think)
depend on whether /bin came before /usr/local/bin in your path.
Then bash would be available in single user mode.  I haven't
done this so I'm not sure what strange things might happen.

There's a whole set of sysadmin horror stories somewhere on the
net, including a bunch on "How I brought down an entire system
by changing root's shell."  Some systems (or older versions of
existing ones) can get into serious trouble if you do this, which
is why some people advise against it.  My view is 1) establish
your "failsafe" and 2) set up the working environment you want.
 
	Annelise




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?Pine.BSF.3.96.990527101824.18910B-100000>