[Top][All Lists]

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

Re: su defaults to root, not user id 0

From: Bob Proulx
Subject: Re: su defaults to root, not user id 0
Date: Wed, 20 Feb 2002 21:16:19 -0700

> This is a somewhat frivolous bug, but my friends and I are wondering why
> su defaults to user 'root' instead of to Unix user id 0. That is, if I
> change the user name of the Unix account with id 0, su no longer
> defaults correctly to that user name.
> Any thoughts on the rationale behind this implementation decision?

Some things are that way because they have always been that way.  The
su command has always done it that way and has been documented like
that for a long time.  Probably for no good reason.  But no compelling
reason to change it either.  Defaulting to uid 0 would probably be
more valid.

I can guess that the rationale went like this.  "'su user', look up
user with getpwnam(), extract uid, setuid(newuid).  Hmm...  What to do
as a default so that I can switch to root.  I know, if no user is
specified then switch in 'root' right at the front of that process and
then nothing later needs to change!"  And so it goes.

This discussion is off topic for the bug list.  I suggest you ponder
this further on the comp.misc.discuss news group.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]