Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to grant a user access to a system service
#1

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'):

 



Code:
<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? :)

 

z0ny

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)