Running svn as apache user

This topic is 3653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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 on other sites
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 on other sites
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 on other sites
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