Date: Mon, 22 Feb 2016 03:27:02 +0100 From: Polytropon <freebsd@edvax.de> To: Yudi V <yudi.tux@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: minimize use of root account Message-ID: <20160222032702.86529bdb.freebsd@edvax.de> In-Reply-To: <CACo--msQEWmwq4ARwr2XxFrvFwVZ%2Ba-0rdxw8ugVrkREhRbeSg@mail.gmail.com> References: <CACo--mv9qU2ZwtTuZRQBpioEr%2BenT=sd-SJ79BFumZt5aL18jg@mail.gmail.com> <20160219120503.fc97ef10.freebsd@edvax.de> <CACo--msQEWmwq4ARwr2XxFrvFwVZ%2Ba-0rdxw8ugVrkREhRbeSg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 22 Feb 2016 13:07:28 +1100, Yudi V wrote: > Thanks Polytropon. > > based on the answers here looks like the best answer is to use SUDO or > SUPER. A good idea. You need to see if you prefer sudo or super. Both have their individual strengths, but sudo is probably the one you'll find more often. > > > ############### > > > #!/bin/csh -f > > > > Why?! > > > > There's a relevant article: "Csh Programming Considered Harmful" written > > by Tom Christiansen. > > > > https://www-uxsup.csx.cam.ac.uk/misc/csh.html > > > > I have written one (!) csh script and I still regret it, maybe because > > it still works. :-) > > > > On FreeBSD, the default shell script interpreter is /bin/sh. > > > > > I am fairly new to Freebsd and I checked the shell variable before I wrote > the script and as it said CSH, I just went with the csh script. The C shell is the default interactive shell (dialog shell), while /bin/sh is the default non-interactive shell (script shell), which you can see as most system scripts start with "#!/bin/sh". It tends to be more readable and portable than the C shell (which isn't even the best imaginable interactive shell, as many users seem to prefer bash or zsh which can easily be installed on FreeBSD). > I did not > get why the user shell is /bin/sh and the root is /bin/csh. For all users (including root) /bin/csh is the default dialog shell. It's easy to set a different shell using the "chsh" command. The shell to use must be listed in /etc/shells. The more simple /bin/sh is used as dialog shell only in single user mode (maintenance mode) by default. > This is on a personal backup server and only has few scripts. I dont want > to readup on yet another shell scripting (someone in the forum mentioned > that /bin/sh is Almquist's Shell NOT bash). That is correct - it's "ash" (Almquist's Shell), which is a close re-implementation of the traditional Bourne Shell; bash is the Bourne Again Shell (common in Linux) which can be seen as a superset of the Bourne shell. So bash usually executes sh code, and sh code tends to be the most reliable and portable. > I am just happy if they work as intended. If the server was > meant for anything else I will definitely not use csh scripts. As I said, I'm guilty myself of writing one csh script which is still in use and still works, even though is so full of bullshit it should go into /dev/null. ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160222032702.86529bdb.freebsd>