Search Our Database

How to create a user with root privilege?

Last updated on |
by

We would not recommend end-users to use their root account to access their web servers as the root account can be easily compromised and might cause harm to other accounts hosting on the same server. As such, it is a good practice to create a user account, of your choice, with the same privileges.

Step 1 – Access your web server via SSH and log in with your root account.

Step 2 – Run the following commands to create a new user and its password; replace “tester” with your choice of username.
# useradd tester # passwd tester

 

Step 3 – After creating a new user account, you need to grant the account root privileges;  type and execute the following command:

# cp /etc/sudoers /etc/sudoers.bak
# cat /etc/sudoers.bak | sed '/# %wheel/ a tester        ALL=(ALL)       NOPASSWD: ALL' > /etc/sudoers

 

Step 4 – When done, you can now log in to access your web server with the new user account; you now do not need to key in your root account’s password each time you perform a command.

# sudo su

 

Check out IPServerOne’s Hosting Plans.
Contact us @ +603-2026 1688 or email @ sales@ipserverone.com