# Sudo. How to give permissions to restart daemon?



## urello (May 21, 2014)

I want to give a particular user the permission to restart /usr/local/sbin/rinetd daemon.
I know two possibilities to restart this daemon

```
/usr/local/etc/rc.d/rinetd restart
```
or

```
kill -1 `cat /var/run/rinetd.pid`
```
The following way is *not* supported by /usr/local/sbin/rinetd

```
/usr/local/sbin/rinetd restart
```
How to give the permission to user without giving access to whole /bin/kill command?


----------



## SirDice (May 21, 2014)

Besides running the scripts in /usr/local/etc/rc.d there's also the service(8) command. It's easier to remember. To allow a user to restart it you'll need a line like this:

```
dice ALL=(ALL) NOPASSWD: service rinetd restart
```

You don't have to allow a single command, it can be a complete command including parameters.


----------



## mrjayviper (May 22, 2014)

Where do I put that @SirDice? Thanks.


----------



## urello (May 22, 2014)

SirDice said:
			
		

> Besides running the scripts in /usr/local/etc/rc.d there's also the service(8) command. It's easier to remember. To allow a user to restart it you'll need a line like this:
> 
> ```
> dice ALL=(ALL) NOPASSWD: service rinetd restart
> ...


Thanks. It did the trick.



			
				mrjayviper said:
			
		

> Where do I put that SirDice? Thanks


In /usr/local/etc/sudoers.


----------



## SirDice (May 22, 2014)

urello said:
			
		

> mrjayviper said:
> 
> 
> 
> ...


Don't edit that file directly, use visudo(8) to edit it. This will prevent any issues with locking and/or multiple users trying to modify the file.


----------



## mrjayviper (May 22, 2014)

Thanks @urello/@SirDice.


----------

