How To Create An Almost Root Equivalent Users But Not Root Identical User in Linux

Question: How can we have extra root users, because from security point of view we should keep the root user safe from daily accessing and use another “AS ROOT” user otherwise if root is blocked for any reason we may can’t access the server.

Need to create an almost root equivalent users but not root identical user. How to achieve this?

It is recommend to create new user and provide root privileges to that user so that the user can run administrative task using sudo. Follow the following steps:

1. Add the user:

# useradd -u -g -m -d /home/ -s /bin/ username

2. Take a back up of the file /etc/sudoers:

# cp -pv /etc/sudoers /etc/sudoers.bak

3. Edit the file using visuo command:

# visudo

4. In the file the changes to be made are as follows:

## Allow root to run any commands anywhere
root ALL=(ALL) ALL
username ALL=(ALL) NOPASSWD:ALL      ### add this line
Related Post