[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Scripts in /etc/init.d Question and Comment.



On Sun, Apr 07, 2002 at 07:35:57PM -0400, JPS wrote:
> There is something that has always bothered me about the scripts in
> `/etc/init.d'. Every once in a while I attempt to execute one of these
> scripts while logged in as a non-root user. For example, I might type
> `/etc/init.d/foobar restart' while having the privileges of user `jps'
> (uid=1000). Normally, as the administrator, I would preface the
> previous text with the `sudo' command. Sometimes I forget, and as a
> result, I get all kinds of bogus garbage printed to my error channel;
> and it takes me a confused moment to figure out what went wrong. Try
> it with your favorite init.d script today! I have a simple suggested
> solution that might help alleviate this awkwardness (without obliging
> me to raise my awareness!). How about prefacing the scripts in
> `/etc/init.d' with something along the lines of:
> 
> 	if [ ! $EUID == 0 ]; then
> 		echo "Sorry, this script must run with root privileges."
> 	if
> 
> I am not sure why the script writers do not include something like
> this in all of the init.d scripts. Unless I am overlooking something
> obvious, maybe we can include this type of thing in debian policy?

I don't think this is the right thing, because almost all init scripts
can be run by a non-root user in the Hurd. Also the check isn't good
enough for SE Linux. Maybe you could do chmod o-x for the all the init
scripts or other things, but IMHO those things should not go into
Debian.

Jeroen Dekkers
-- 
Jabber supporter - http://www.jabber.org Jabber ID: jdekkers@jabber.org
Debian GNU supporter - http://www.debian.org http://www.gnu.org
IRC: jeroen@openprojects

Attachment: pgpVdVAL8t3Em.pgp
Description: PGP signature


Reply to: