Use sudo
instead
EDIT: As Douglas pointed out, you can not use cd
in sudo
since it is not an external command. You have to run the commands in a subshell to make the cd
work.
sudo -u $USERNAME -H sh -c "cd ~/$PROJECT; svn update"
sudo -u $USERNAME -H cd ~/$PROJECT
sudo -u $USERNAME svn update
You may be asked to input that user's password, but only once.