Creating Super User

der.hans PLUGd@LuftHans.com
Tue, 6 Mar 2001 22:47:58 -0700 (MST)


Am 06. Mar, 2001 schwäzte Carl Parrish so:

> How does one go about creating a new super user? Simply making them a
> member of the root group doesn't seem to work (this is on RH7.0). Can I
> get rid of the root account after doing this? Will I have to change
> permissions of /etc/passwd and /etc/shadow after doing this? Please tell
> me there is a flag or something to adduser. 

First question is why do you want to do this? It seems that you just want
to change the loginname of the root user. What is your reasoning behind
this?

If you're the only one on the box, then edit /etc/passwd and /etc/shadow
to change the name.

If you're on a system with multiple users, then you want to add a new root
user.

useradd -u 0 -o toor

       -u uid The  numerical  value of the user's ID.  This value
              must be unique, unless the -o option is used.   The
              value  must be non-negative.  The default is to use
              the smallest ID value greater than 99  and  greater
              than every other user.  Values between 0 and 99 are
              typically reserved for system accounts.

Then you can delete the original entry.

userdel root

For a *NIX system you need to have an account with UID of 0 [1]. That's
the real power behind root, the loginname is irrelevant. Changing the
loginname doesn't really do anything and makes it confusing for you and
others who need to use the system.

grep "^[[:alnum:]-]*:[[:alnum:]]*:0:" /etc/passwd

Will find it whatever you name it [2] :).

ciao,

der.hans

[1] Hurd supposedly can allow users to have multiple UIDs or even no
UIDs. Don't know if it needs a superuser. I think I saw something saying
it didn't...

[2] OK, didn't test that regexp too much, but it wouldn't be hard to make
sure it was right :).

-- 
#  der.hans@LuftHans.com   home.pages.de/~lufthans/   www.YourCompanyHere.net ;-)
#  Help Jerry Lewis stamp out M$...oops that's MDA - der.hans