[Hampshire] Permissions query

Top Page

Reply to this message
Author: Leo
Date:  
To: Hampshire LUG
Subject: [Hampshire] Permissions query
Hello. I've been on the Surrey LUG mailing list for a while and have
heard mention of this list, so thought I'd sign up to it too.

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
still get the following error:
./reload-lircd-config-files: line 11: kill: (20748) - Operation not
permitted

Which I'm rather confused by, as I thought it should be running as root??
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

So I was wondering is it safe to $(chown lirc:lirc /dev/lircd) or will
this cause problems.
Failing that does anyone know of another way I can $(kill -HUP
pidOflircd) without being root.

Many thanks,
Leo

* The reasoning behind this is so that I can press a button on the
remote control to switch which programs I want to listen to it.