Why csh on Root?

Joerg Pernfuss elessar at bsdforen.de
Thu Oct 19 23:39:25 UTC 2006

On Thu, 19 Oct 2006 08:03:02 -0500
Martin McCormick <martin at dc.cis.okstate.edu> wrote:

> 	Is there any particular reason why FreeBSD has csh as the
> default root shell?  Nothing really wrong with it except that I
> quit using csh about twelve years ago and so am a little rusty
> about the finer details when I come across a csh shell.  On a
> number of FreeBSD4.x systems, I used chsh to change root's shell
> after installing bash and the only thing I noticed was that one
> should be careful of the $PATH variable and make sure it at least
> hits all the same directories in the same order.  Other than
> that, it worked.
> 	On a recent upgrade to 5.4, I noticed the C shell is
> still default so I figured I would ask before changing it so as
> not to introduce hidden problems later.  Basically, I like bash
> better and also add a couple more paths such as /usr/local/etc
> for home-grown applications.
> 	Thanks for your thoughts.

On first look, FreeBSD seems to come with 3 shells: sh, csh and tcsh

Then again, that is not entirely true.

/bin/sh is actually an ash. Minimal POSIX sh with a few additions that
don't help it anyway near a friendly shell for interactive use.

Then csh and tcsh - they are one and the same, a tcsh.

25183 -r-xr-xr-x  2 root  wheel  333980  5 Sep 16:12 /bin/tcsh*
25183 -r-xr-xr-x  2 root  wheel  333980  5 Sep 16:12 /bin/csh*
^^^^^		  ^
same inode	  link count 2

The reasons for that are many.
- csh is the shell that originated in Berkeley (legacy reason)
- bash isn't quite released unter a two-clause BSDL, which isn't
  desireable as a part of the base (license reason)
- in case of a system failure, the root shell should work
  (single user reason)
- everybody that works a lot on the shell with modify his environment
  anyway to his personal preference (why-bother reason)
- probably more

Neither of these are by itself 100% convincing and you can construct
a "yeah but if..." without any problems. But everyone of these reasons
is by itself able to start one ceremonial bikeshed unlike anything
known to man so far.

Therefor, one could describe the status quo as a truce. The elephant
that everybody sees and noone talks about. The chance of getting a
really broad concensus on these topics is so slim, that it simply isn't
touched. Especially since it isn't broken.

One can add bash3, ksh93, zsh, ... to the system via ports and these
work. One can use toor and asign that user a different shell. One
can simply use `sudo bash' instead of normal `su'/`su -l'. The one
instance where one really needs the root csh is in case of a rather
bad system failure. And an unfamiliar scripting syntax is one's least
problem in that case anyway.

So, either chsh to /usr/local/bin/bash and use plain /bin/sh in
single user situations, or make a statically compiled /bin/bash.
If one is prepared for eventual fallout, the possibilities endless.

| /"\   ASCII ribbon   |  GnuPG Key ID | e86d b753 3deb e749 6c3a |
| \ / campaign against |    0xbbcaad24 | 5706 1f7d 6cfd bbca ad24 |
|  X    HTML in email  |        .the next sentence is true.       |
| / \     and news     |     .the previous sentence was a lie.    |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20061019/41e66434/signature.pgp

More information about the freebsd-questions mailing list