2

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?

Gustav Bertram
  • 137
  • 2
  • 8

1 Answers1

2

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)
Kenny Rasschaert
  • 8,925
  • 3
  • 41
  • 58