Re: Second ROOT account

From: pbs (pnews_at_lomarline.freeserve.co.uk)
Date: 08/26/03


Date: Wed, 27 Aug 2003 01:38:26 +1200

Bill Unruh wrote:
> pbs <pnews@lomarline.freeserve.co.uk> 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
> has
> The getpwnam() function returns a pointer to a structure containing the
> broken out fields of a line from /etc/passwd for the entry that
> matches
> 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?



Relevant Pages

  • Re: User Information (Easy Questions!)
    ... which will tell you the users' UID and what groups they are a member of. ... the password file can lock you out of the machine. ... No -- file and program ownership is recorded in the filesystem using ... from username to UID. ...
    (freebsd-questions)
  • Re: perl intersect problem
    ... the output password file. ... disappearance but always the same few users are filtering. ... In the Unix password file format the user name has to be unique however the UID need not be so it is possible that two or more users have the same UID. ... sub Sort { ...
    (perl.beginners)
  • Re: perl intersect problem
    ... the output password file. ... sub Sort { ... next if $seen{$uid}++; ... instead of calling split twice ...
    (perl.beginners)
  • Re: perl intersect problem
    ... Doesn't your password file already have unique usernames and unique UIDs? ... UID or username are duplicates; are those the ones you can't find? ...
    (perl.beginners)
  • perl intersect problem
    ... I have a very strange problem. ... subroutine to sort unique a UNIX password file based on UID and ... the output password file. ... next if $seen{$uid}++; ...
    (perl.beginners)