Re: Second ROOT account
From: pbs (pnews_at_lomarline.freeserve.co.uk)
Date: Wed, 27 Aug 2003 01:38:26 +1200
Bill Unruh wrote:
> pbs <email@example.com> writes:
> ]Saikat Guha wrote:
> ]> Sybren Stuvel wrote:
> ]>>Eric enlightened us with:
> ]>>>I would create a second root account on my machine ? How can i do
> ]>>>it ? (i have Red Hat 9)
> ]>>You can't. You can give other people (limited or unlimited) root
> ]>>access with 'sudo' though.
> ]> You can add another user with uid=0, gid=0 in the /etc/passwd file. Although
> ]> they will have their own username and password for login purposes, once
> ]> they log in, the shell variables and the prompt etc will still say root.
> ]They may not. I think that this is undefined behaviour, it depends what
> ]algorythm is used for accessing the password file. I would not bet my
> ]system on this.
> ?? An experiment will make it clear.
> On login, the getpwnam is used, since that is the only info the system
> The getpwnam() function returns a pointer to a structure containing the
> broken out fields of a line from /etc/passwd for the entry that
> the user name name.
> From this the uid is obtained, which in this case is 0. Thereafter as
> always with Linux, the uid is used, which is uid 0
> I have often done exactly this-- had two names with uid 0, both in SunOS
> and in Linux, and it has always worked fine.
"Thats the spirit!" -- Roy Batty (Hauer) in Blade Runner
Just 4 examples: who, id, ls -l and ps -ef, both list with uname.
who returns login name not the passwd name for the uid.
So you can garantee the return on getpwuid(3) and any script or
programs which may access the passwd file in other ways, or by
utmp/login, when you have more than one line with the same uid?