Using sudo to Assign Root Access to a User on a Linux Server
Attimes you are required to offer Root access for a particular account having limited privileges on a server. You must follow the below steps to assign Root Access to a particular user using sudo.
Step 1 : Login to the server as root.
Step 2 : Run the following command :
[email protected] [~]# 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 should be able to create a group of users whom you can then assign command aliases to. You only need to ensure that the users are separated using a comma (,).
The Cmnd_Alias would show you a list of different commands that the users of a particular Alias can run. You may then choose the user alias and assign the command alias.
The above would ask the user to enter his/er password each time sudo is run. Though if don’t want the system to ask for a password each time, you may replace
ADMINS ALL = HTTPD in the last line with the following :
ADMINS ALL = NOPASSWD: HTTPD
Like this post ?
Share on your Social Networking Profile ( Facebook, Twitter & Google+ ) and get a flat 10% Recurring discount on our VPS Hosting and Dedicated Servers.
Email us the shared link at : [email protected] or speak to our live chat operator now, by clicking on the “Live Chat” Scroller on the left-hand side of this page and we will provide you with the discount Coupon right away!