Your Webhosting Questions
Answered by the Webhosting Experts
Tags
...
...

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

Please refer the following steps:

 

a. Login to the server as root.

 

b. Execute the following command:

root@host [~]# visudo

c. The screen would show you sudoers file in the vi editor. Include the

below line into this file to assign complete root privileges to an account

(in this case it is accountname)

accountname ALL=(ALL) ALL

d. If you want that the user should be able to run particular 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

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.

In the above case user would be asked to enter password each time sudo is run. Though if you 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

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: [email protected]. We are also available to you through our phone and live chat system 24/7/365.

Tags +
...