How to create extra root user?

Premise: using sudo (as suggested by the accepted answer) probably is the correct solution at your problem.

That said, if you really need something resembling a second root account, you can create an alias to the system root account.

To do that, follow these steps:

  1. open /etc/passwd
  2. locate the root account line (often the very first line). It will be something similar to root:x:0:0:root:/root:/bin/bash
  3. copy/paste it changing the first root occurence in root2 (ie: changing it in root2:x:0:0:root:/root:/bin/bash)
  4. save your changes and exit the text editor
  5. issue passwd root2 and enter the new password

Note: if you whish, you can avoid direct editing the /etc/passwd file by replacing steps 1-3 with the following command: useradd -o -u 0 -g 0 -N -d /root/ -M root2 (see useradd --help for more information about the required options)

At this point, you can login using not only the original root account (with its original password), but also using the new root2 account (with its new password).

Anyway, remember that it is an alias of an existing user, rather than a completely new user. This means that any files created while logged as root2 have the very same numerical oid/gid of the original system root account (which has 0 as both uid and gid).


You can't. root is a special user with uid 0. Use sudo instead.