Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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

share|improve this answer
    
nice idea. I'll try that. –  Derek Organ Oct 7 '10 at 22:52

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

share|improve this answer
    
thats what I thought but for some reason i'm still getting the error. –  Derek Organ Oct 7 '10 at 22:52
    
its seems it's www-data.. –  Derek Organ Oct 8 '10 at 0:22
    
if it's running as www-data, it looks like you're serving the repo through apache, not svnserve –  Hubert Kario Oct 8 '10 at 10:13
up vote 0 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.