How to Use sudo to Assign Root Access to a User on a Linux Server

Using sudo to Assign Root Access to a User on a Linux Server

Attimes you’re needed to supply Root access for a specific account having limited privileges on a server. you need to follow the below steps to assign Root Access to a specific user using sudo.

Step 1 : Login to the server as root.

Step 2 : Run the following command :

root@host [~]# visudo

Step 3 : The screen displayed would be of the sudoers file in the vi editor. You must include the belwow line into this file to assign complete root privileges to an account (in our case it is accountname).:

accountname ALL=(ALL) ALL

Step 4 : If you do not intend to offer the complete access but be able to run a particular list of commands, you may create a command alias in your sudoers file, for example:

User_Alias ADMINS = accountname
Cmnd_Alias HTTPD = /etc/init.d/httpd
ADMINS ALL = HTTPD

With this, you must be able tocreate a group of users whom you’ll be able to then assign command aliases to. you simply need to make sure that the users are separated using a comma (,).

The Cmnd_Alias would show you a list of different commands that the users of a specific Alias can run. You may then select the user alias and assign the command alias.

The above would raise the user to enter his/er password every time sudo is run. Although if don’t wish the system to raise a password every time, you’ll replace ADMINS ALL = HTTPD within the last line with the following:

ADMINS ALL = NOPASSWD: HTTPD

Incase you wish any help with this, please contact our support department via. 24×7 Live Chat out there at www.ownwebservers.com.