Tuesday 29 November 2016

Add a User and Grant Root Privileges on CentOS 7



Step 1: Add the User

Add new user use the below command:


[root@linuxcnf ~]#adduser newuser

Now set the password for the new user:

[root@linuxcnf ~]#passwd newuser

Step 2: Grant Root Privileges to the User

[root@linuxcnf ~]#visudo

#Find the following code:

root ALL=(ALL) ALL

Add the following line after above code as below:

newuser ALL=(ALL) ALL

Then exit and save the file with the command :wq .
You should now have a user setup by the name of newuser which can use sudo to run commands as root..

No comments:

Post a Comment