[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

reason and workaround for Can't open file '/root/.subversion/servers' problem

From: Иван Чернявский <camposer_at_yandex.ru>
Date: Wed, 09 Jan 2008 15:12:38 +0300

Hi all,

as there are several places in the web where problem with above error message is described (usually when dealing with Subversion from inside an PHP script), I've deciced to post my findings here --- maybe they will help someone. If this was already written somewhere --- sorry! When I've encountered this problem myself, I didn't found any.

The problem --- in short: When trying to call executable 'svn' with any params from PHP script, you may encounter message like following in your web server log (and of course command is not executed):

svn: Can't open file '/root/.subversion/servers': Permission denied

This is very confusing as usually web servers (e.g. Apache) are run not as root, but as 'nobody' or 'daemon' or 'www' etc. So why root is here?!..

I performed 'set' from the same script and it appeared the reason was simple: $HOME environment variable was set to /root!! So it seems, Apache is starting as root and then changing to requested user, but somehow $HOME is not changed.

Obvious workaround is to use command like this:

  $cmd_string = 'export HOME=/var/lib/nobody; ' . $svn_command;

where /var/lib/nobody is just an example (this is usual home dir for user 'nobody') and $svn_command is the command you needed to execute.

As I remember, I've encountered the same problem using SVN extension for PHP, so probably should also post to http://pecl.php.net/package/svn...

Kind regards,

   Ivan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-01-09 16:49:56 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.