Rsync error 13 permission denied

Jump to: navigation, search

Sometimes when using `su` to run a script that runs `rsync` you will get an error like this:

rsync: pop_dir "/home/svn" failed: Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at flist.c(1222)

In my case I was starting a script as root and the script was using `su` to change the user to "svn".

su svn -c "/home/svn/"

The fix was simply to tell `su` to use the user's environment. Note the dash after `su`:

su - svn -c "/home/svn/"