We want to automate the creation of the svn repos and trac environments for new projects. Basically, this would mean creating a web script that got some info (like env and repo name, etc) from the user and then executed

sudo -u svn svnadmin create /var/svn/<projectname>
trac-admin /var/trac/sites/<projectname> initenv [... All extra params...]

For the second command, this is simple, as it already runs as the www-data user, so I wouldn't have to use sudo. But for the first command, I'd have to use sudo and add www-data to the sudoers file. I was wondering if this is a good idea, and how to do it in that case. Reading the manpage has left me with more doubts than certainties about this.

This webserver would only be accessible from our internal network, by the way. The OS is Ubuntu Server 10.04.

1 Answer 1



Setting the /var/svn folder owner to www-data:

chown -R www-data:www-data /var/svn

and you can then create a subversion repository from a webpage without sudo.

If you really want to do that, let's limit the www-data user to run svnadmin command without prompting for password. Type visudo and add the following line:

www-data  ALL=(ALL)   NOPASSWD:/usr/bin/svnadmin
  • I don't "really" want to do it, it just sounds an easy option. I'm more of a programmer than a sysadmin, though I know enough to be dangerous. What would be a better option? Nov 25, 2011 at 18:01
  • updated my answer.
    – quanta
    Nov 25, 2011 at 18:28
  • Well, yes, that was much easier and safer. Nov 25, 2011 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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