Sign in to follow this  
BeanDog

Running svn as apache user

Recommended Posts

BeanDog    1065
I have some PHP scripts that were running svn commands through shell_exec(). They were working fine, but have mysteriously stopped working altogether. If I SSH onto the server as root, and do this: sudo -u apache svn help I get an error: svn: Can't open file '/root/.subversion/servers': Permission denied That's right, even the svn help command is trying to access this file. In desperation, I set permissions to 777 on the /root/.subversion directory, and even changed its owner to apache. (chown -R apache /root/.subversion; chmod -R 777 /root/.subversion). Neither of those helped. Anyone have an idea of what I might do with this?

Share this post


Link to post
Share on other sites
Sander    1332
What's the home directory of the apache user? You can check in /etc/passwd. The user executing the `svn` commando must have a valid home directory and must be able to write the .subversion directory there.

Share this post


Link to post
Share on other sites
BeanDog    1065
Looks like it was a bizarre SELinux issue--the httpd process was for some reason running in the contect of root rather than user_u, so it was checking /root rather than /somewhereelse. Maybe because I /etc/init.d/httpd restart'ed as root? Anyway, simply rebooting the server took care of the problem.

Thanks anyway!

Share this post


Link to post
Share on other sites
Sander    1332
Quote:
Maybe because I /etc/init.d/httpd restart'ed as root?


No. Only root can use the scripts in /etc/init.d. The script then takes care of running as the right user. Besides that, Apache also takes care of running at the right user itself. The user Apache is supposed to run at is defined in httpd.conf

Share this post


Link to post
Share on other sites
Sign in to follow this