1

I've a debian webserver with subversion running on it.

I'm trying to use post-commit script to update my staging version of my site.

#!/bin/sh

/usr/bin/svn update /home/sites/example.com/www >> /var/log/svn/example.log 2>&1

if I run that command from the command line logged in as user 'derek' then it all works fine

but when it runs as post-commit I get the following error in my log file:

svn: Can't open file '/home/sites/example.com/www/.svn/lock': Permission denied

Ok, so I realize what is happening here is the user calling the post-commit script isn't 'derek' so it hasn't permission.

So my question is what user is calling the post-commit script.

the svnserve daemon is run as derek ... I thought that would mean the post-commit command would be called as derek too but it seems not.

Any ideas how I can find out what user is calling it

and secondly what would be the best practice method to allow access for that user? I don't think adding it to the group would help because the group doesn't have the write access to the .svn directories by default.

UPDATE: I've just found that www-data is the user that seems to be calling the script. Now naturally www-data can't run the svn command.

3 Answers 3

1

who am i >> /var/log/svn/example.log will output under which user the command is running.

1
  • nice idea. I'll try that. Oct 7, 2010 at 22:52
1

Hmm. The hooks are run as the user svnserve is running as.

http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks

Subversion executes hooks as the same user who owns the process that is accessing the Subversion repository. In most cases, the repository is being accessed via a Subversion server, so this user is the same user as whom the server runs on the system

3
  • thats what I thought but for some reason i'm still getting the error. Oct 7, 2010 at 22:52
  • its seems it's www-data.. Oct 8, 2010 at 0:22
  • if it's running as www-data, it looks like you're serving the repo through apache, not svnserve Oct 8, 2010 at 10:13
0

I got it working. I had to write my own c program but it works!

thanks to info I found here: http://forum.webfaction.com/viewtopic.php?pid=216#p216

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .