Jump to content
Sign in to follow this  

How to grant a user access to a system service

Recommended Posts

Let's assume some friend of yours (or even you?) wants to run a system service (or anything else that requires root privileges) on your box and you allow him to do that. Unfortunately the service requires root privileges and you don't want to give him your root password. The solution is 'sudo'.


Step 1: Locate the service

Locate the executable of the service, if you use 'service <name> <on|off|...>' as root a good place to look is within '/etc/init.d/'.


Step 2: Allow the use of 'sudo'

You have to add the target user to the sudoers list in order to grant him the priviledge to use 'sudo'. That is done by executing 'visudo' (it is recommended to use that command instead of editing the file directly) as root. As we don't want the user to be prompted for a password we add the following to that file (information about the syntax and stuff can be gathered from 'man sudoers'):


<user>   ALL=NOPASSWD: /etc/init.d/<name>


We repeat that for every "root-command" (= command that requires root privileges) the user needs access to. After saving the file the specified user is able to control the program by placing 'sudo' in front of the command, in example 'sudo /etc/init.d/<name>'. Kinda easy, isn't it? :)



  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...