From owner-freebsd-questions Thu May 27 11:15:49 1999 Delivered-To: freebsd-questions@freebsd.org Received: from andrsn.stanford.edu (andrsn.Stanford.EDU [36.33.0.163]) by hub.freebsd.org (Postfix) with ESMTP id B0D1C15094 for ; Thu, 27 May 1999 11:15:45 -0700 (PDT) (envelope-from andrsn@andrsn.stanford.edu) Received: from localhost (andrsn@localhost.stanford.edu [127.0.0.1]) by andrsn.stanford.edu (8.9.1/8.9.1) with SMTP id LAA19182; Thu, 27 May 1999 11:11:24 -0700 (PDT) Date: Thu, 27 May 1999 11:11:24 -0700 (PDT) From: Annelise Anderson Reply-To: Annelise Anderson To: Pete Vanderburgh Cc: "James A. Mutter" , Alfred Perlstein , ". ." , freebsd-questions@FreeBSD.ORG Subject: Re: why we don't mess with root's shell: Re: Need help withRoot shell? In-Reply-To: <374D79CD.969EA9AC@verio.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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