Re: [Hampshire] Permissions query

Top Page
Author: Hugo Mills
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Permissions query

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x581ed100.hantslug.org.uk.6327': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Sun Oct 26 20:29:35 2008 GMT
gpg: using DSA key 20ACB3BE515C238D
gpg: Can't check signature: No public key
On Sun, Oct 26, 2008 at 08:07:20PM +0000, Leo wrote:
> I've a query about permissions that I'm hoping someone can help me with.
> I want to send a HUP signal to the lircd daemon to get it to reload its
> config files*. However I don't want to have to be root to do this. First
> off I tried the following script:
>
> #!/bin/bash
> pidString=$(ps -e -o comm,pid | grep "^lircd")
> if [ -n "$pidString" ]
> then
>     # lircd is running
>     pid=$(echo $pidString | sed "s/[^0-9]*//g")
>     kill -HUP $pid
> fi

>
> with it being owned by root and having its setuid bit set. However I


The suid/sgid bits don't work for scripts (i.e. anything with a #!
line at the top), for security reasons.

[snip]
> So then I opted for getting the lircd daemon to run as someone other
> than root (namely lirc) add myself to a similar group and have
> permission to kill it that way. However it's not happy with this. I get
> the following error when trying to start the daemon:
> lircd: could not delete /dev/lircd
> Permission denied


Put yourself into the lirc group, install sudo, and use "visudo" to
add the following line to /etc/sudoers:

%lirc ALL = NOPASSWD: killall -HUP lircd

Then you should be able to do:

$ sudo killall -HUP lircd

without supplying a password, but do nothing else without having to
supply a password.

Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- Two things came out of Berkeley in the 1960s: LSD and Unix. ---   
                       This is not a coincidence.