From owner-freebsd-questions Fri Oct 13 16:29:15 2000 Delivered-To: freebsd-questions@freebsd.org Received: from static.unixfreak.org (static.unixfreak.org [63.198.170.139]) by hub.freebsd.org (Postfix) with ESMTP id D6A7137B66F for ; Fri, 13 Oct 2000 16:29:08 -0700 (PDT) Received: by static.unixfreak.org (Postfix, from userid 1000) id 8EA7B1F0D; Fri, 13 Oct 2000 16:29:07 -0700 (PDT) Subject: Re: changing root shell?? In-Reply-To: "from Mike Eldridge at Oct 13, 2000 05:49:56 pm" To: Mike Eldridge Date: Fri, 13 Oct 2000 16:29:07 -0700 (PDT) Cc: media@mail1.nai.net, freebsd-questions@FreeBSD.ORG From: Dima Dorfman Reply-To: dima@unixfreak.org X-Mailer: ELM [version 2.4ME+ PL82 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <20001013232907.8EA7B1F0D@static.unixfreak.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > On Fri, 13 Oct 2000 media@mail1.nai.net wrote: > > I thought I was running sh. For some stupid reason I though sh was the > > default Unix shell. Maybe I should stop using a kerosene heater and wear a > > helmet. As it turns out, root is csh. I've been entering commands with sh > > syntax all along. I haven't received any syntax errors. Does this mean I > > could have trashed my system without knowing it?? > > I'm not sure about FreeBSD (since I haven't gotten it installed on my > alpha yet, so assume me to be a freebsd newbie =P), but under Linux > (redhat at least), /bin/sh is a symbolic link to /bin/bash. I don't > like /bin/sh is not bash on FreeBSD. /bin/bash doesn't even exist. > > >Which is now part of the base system; csh is a hard link to tcsh: > > > > > > # ls -li `which csh tcsh` > > > 335 -r-xr-xr-x 2 root wheel 622684 15 Jul 01:46 /bin/csh > > > 335 -r-xr-xr-x 2 root wheel 622684 15 Jul 01:46 /bin/tcsh > > > > My tcsh is in /usr/local/bin/tcsh, which wouldn't work in single user mode. > > That's bad. All files that are integral to the system (ie, required > for the system to boot in single user mode for rescue, recovery, > etc) should be in the root filesystem. You'll find that most all > basic, useful binaries are located in /bin (ie, ls, sh, touch, su, > > >rm, Actually, touch and su are in /usr/bin. > etc). Your tcsh should be in /bin. Tcsh is in /bin in the default install since somewhere between 4.0-RELEASE and 4.1-RELEASE. > > > At 9:46 AM +0930 07/19/00, Greg Lehey wrote: > > > > > >This is the real point. Why learn two shells when you can make do > > >with one? At some point you'll need to know the a Bourne shell family > > >member, so why bother learning a csh shell? > > > > This is the guy who wrote the @$#%* book, yet FreeBSD still starts up as > > csh!! In his book he says he uses bash. I've installed bash, but his book > > also explains that I can't use it as root because it's dynamically linked > > (whatever that means). > > So change it. Change it /bin/bash. Dynamically linked means that > the Unless you put it there, which you probably shouldn't, IMO, it isn't there. > binary was linked to a shared object library that has to be loaded every > time you want to run the program. I have no clue why he would say that > you couldn't use it because it's dynamically linked. Of course you can > use it if it's dynamically linked. Just make sure that any libs that it > is linked to aren't out of reach in an emergency situation. Libc is in /usr/lib, so unless your / and /usr are on the same filesystem, the required libraries would be out of reach. If you really want to use bash as your root shell--this is probably a bad idea--you can manually compile a statically-linked copy and name it something like /sbin/bash.static--I used to do this with tcsh before it was in the base system. > > > I have heard that you should not change your root shell. However, sh seems > > to be in /bin on the root filesystem. So I don't see how that would cause > > problem. How would I go about changing it?? I'd also like to change my > > default editor (as I find vi very cumbersome). The book refers to editing > > files, but I can't seem to find which files I'm supposed to edit. You can change it to /bin/sh with little or no consequences. > > Edit /etc/passwd and change the /bin/sh or /bin/csh or what-have-you to > whatever you want your shell to be. /etc/passwd is generated from /etc/master.passwd. You should use `vipw`, or failing that, edit /etc/master.passwd and rebuild the password databases (something like `pwd_mkdb -p /etc/passwd`, I think). > If you don't want to use vi, simply use another editor. Instead of typing > vi, type pico or type emacs (assuming these are installed). Setting the environment variable EDITOR will make some programs--vipw, chsh, and crontab, for example--use the editor you specify. In (t)csh, the syntax to do that is: "setenv EDITOR emacs" where emacs is the editor you would like to use. I'm not sure about the (ba)sh syntax, but I believe it's something like "export EDITOR=emacs". Hope this helps -- Dima Dorfman Finger dima@unixfreak.org for my public PGP key. "Natural ability without education has more often raised a man to glory and virtue than education without natural ability." -- Marcus Cicero To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message