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.

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.

share|improve this question

1 Answer 1

UPDATE

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
share|improve this answer
    
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? –  Adriano Varoli Piazza Nov 25 '11 at 18:01
    
updated my answer. –  quanta Nov 25 '11 at 18:28
    
Well, yes, that was much easier and safer. –  Adriano Varoli Piazza Nov 25 '11 at 18:47

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.