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

I have a website on an Ubuntu box. I've changed the ownership of the files to www-data:www-data.

To update the files, I usually have to run sudo svn up, but that changes some of the file ownerships back to root:root. Is there a way to run svn up as www-data?

share|improve this question
    
Try by running svn update --username wwwdata. –  Caterpillar Mar 25 '13 at 12:24
    
You misunderstand. I don't wish to log into the svn server as www-data, I wish to run svn up as www-data, so that the updated files retain www-data as owner. –  Gustav Bertram Mar 25 '13 at 12:28

1 Answer 1

up vote 1 down vote accepted

I think a better solution would be to set the gid bit of the directory where the files are (your web root). Have a look at this question and the excellent accepted answer.

This way, all new files in your web root directory will have the default group of the web server. Apache will be able to serve these and your problem should be solved.


If you really want to do what you suggested, you can change the owner of the svn program and set the setuid bit.

chown www-data $(which svn)
chmod 4755 $(which svn)

After doing this, every time the svn command is run, it will run as if it was invoked by the www-data user.

If you wish to undo this later, do the following:

chown root $(which svn)
chmod 0755 $(which svn)
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.