wrong user running post-processing script
Posted: March 6th, 2009, 9:02 pm
Hi everyone,
I'm running sabnzbd 0.4.6 as a service under Gentoo Linux with the daemon running as its own user. The problem I'm having is that all post-processing scripts are being run by the root user and I would like them to be run by the same user that runs the daemon. When I manually invoke sabnzbd, all post-processing scripts are run by the same user (which is the expected behavior) so I know this isn't an issue with sabnzbd but with Gentoo. Here is the init script that's responsible for start/stopping sabnzbd:
Any Gentoo users out there that have run into this sort of problem before? Is this normal behavior when su'ing from root to another user in order to start a process? Any help would be much appreciated.
Thanks,
Kierse
I'm running sabnzbd 0.4.6 as a service under Gentoo Linux with the daemon running as its own user. The problem I'm having is that all post-processing scripts are being run by the root user and I would like them to be run by the same user that runs the daemon. When I manually invoke sabnzbd, all post-processing scripts are run by the same user (which is the expected behavior) so I know this isn't an issue with sabnzbd but with Gentoo. Here is the init script that's responsible for start/stopping sabnzbd:
Code: Select all
opts="start stop"
depend() {
need net
}
start() {
ebegin "Starting SABnzbd"
if ! check_config ; then
eend 1
return 1
fi
start-stop-daemon --quiet --start -c ${SAB_USER} \
-g ${SAB_GROUP} --name SABnzbd.py \
--exec /usr/bin/SABnzbd.py -- \
-s ${SAB_HOSTNAME}:${SAB_PORT} -f ${SAB_CONFIGFILE} -d &> /dev/null
eend $?
}
stop() {
ebegin "Stopping SABnzbd"
URL="http://${SAB_HOSTNAME}:${SAB_PORT}/sabnzbd/shutdown"
if [ -x /usr/bin/wget ] ; then
/usr/bin/wget -q --delete-after "${URL}"
elif [ -x /usr/bin/curl ] ; then
/usr/bin/curl --silent "${URL}" > /dev/null 2> /dev/null
else
ewarn "missing wget and curl, ending all processes named SABnzbd.py"
start-stop-daemon --quiet --stop --name SABnzbd.py
fi
eend $?
}
check_config() {
if [ ! -e ${SAB_CONFIGFILE} ] ; then
eerror "ERROR: can't find ${SAB_CONFIGFILE}."
return 1
else
return 0
fi
}
Thanks,
Kierse