Running rc.d programs under a different user

Charles Solar redcomet87 at
Sat Feb 6 22:11:01 PST 2010

LFS is working great, and I can safely say I know much more about linux then
I did before going through the book, so thanks to all those who contributed.

I am wrapping up my fileserver built from LFS SVN 2010-01-09 and I am trying
to find a way to run a daemon process as a different user.
In the book we only used the apps config file to specify a different user,
ex, svn, proftpd.  But I want to run Deluge under a different user and it
does not have a config option for this.  So I am wondering if there is some
way I am 'supposed' to setup the init script to do this.  I am trying to
avoid installing any more unnecessary programs like daemon and
start-stop-daemon so any advice is appreciated.

Basically I want to mimic the provided example init scripts from here

This is what I am using at the moment
# Deluge daemon startup

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
                boot_mesg "Starting deluged service..."
                loadproc -p /var/run/ /usr/sbin/deluged -c
/etc/deluge/ -p 58840 -l /var/log/deluged.log
                if [ $RETVAL -eq 0 ] ; then
                        boot_mesg "Starting deluge web ui..."
                        loadproc -p /var/run/
/usr/sbin/deluge-web -f -c /etc/deluge/ -l /var/log/webluged.log
                boot_mesg "Stopping deluged service..."
                killproc /usr/sbin/deluged
                boot_mesg "Stopping deluge web ui..."
                killproc /usr/sbin/deluge-web
                $0 stop
                sleep 1
                $0 start
                statusproc /usr/bin/deluged
                echo "Usage: $0 {start|stop|restart|status}"
                exit 1

I checked out the functions library and did not see anything jump out at me.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the lfs-support mailing list