I want to start a daemon as another user, but it doesn't seem to work. What I'm trying to do is run svnserve (subversion server) as the apache user.
The following works, but it's run as the root user in this case
Code:
svnserve -d -r /var/www/svn --pid-file /var/run/svnserve.pid
Trying to run as apache user doesn't work
Code:
su apache -c "svnserve -d -r /var/www/svn --pid-file /var/run/svnserve.pid"
And neither does the following, with or without quotation marks
Code:
source /etc/rc.d/init.d/functions && daemon --user=apache "svnserve -d -r /var/www/svn --pid-file /var/run/svnserve.pid"
At first I thought it was that the apache user doesn't have write permissions to /var/run (for svnserve.pid), but that doesn't seem to be the problem because changing it to another directory also doesn't work.
(I'm trying to write my own init.d service script for svnserve, as in
http://www.mygeekproject.com/?p=152, because surprisingly svn server doesn't seem to come with its own.)
Any ideas on how I can make this work? Thanks.