How to create a secondary root user on CentOS

Lets show you how to create a secondary root user.
To add a user and allow him the root privileges by editing the /etc/passwd file. Add a user as root
# useradd newuser

set a password for the new user

# passwd newuser

Once done, edit the ‘passwd’ file

# vi /etc/passwd

set the UID:GUD bits to 0:0. Say for example the new user is ‘admin’, the line should look like


Note: This method increases the security risk on the server and the best method is to add the new user in the sudoers list. You can also allow a list of commands for the new user beyond which he won’t be able to execute any commands as root.