Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to fire "svn update" command from a php script , the user for which is "apache". How can I assign permissions to apache user to execute "svn update" ?

share|improve this question
up vote 3 down vote accepted

I would create a command in the sudoers file, and then use sudo -u user-who-owns-svn-repo svn update in your PHP script.

The changes to /etc/sudores would be similar to:

Cmnd_Alias      SVN = /usr/local/bin/svn
apache          ALL=(ALL,!root,!#0) NOPASSWD: SVN

See the Sudoers manual for more info.

If you want tighter controls, make shell scripts that have the specific SVN commands and only allow Apache access to those. For example:

File /path/to/my/project/

svn update /path/to/my/project/svn-files

File /etc/sudores:

Cmnd_Alias      SVN = /path/to/my/project/
apache          ALL=(ALL,!root,!#0) NOPASSWD: SVN

(and don't forget to chmod +x path/to/my/project/

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .