Rsync to Directory on Backup Account - Permission Denied



I’m trying to use rsync to backup from my DH VPS to a directory on my DH backup server. I have password-less login setup and that part is working fine. But whatever I try with rsync, it fails and issues “Permission denied (13)” errors.

As a first attempt I tried to copy a single file (test1.php) from my server to a directory (backupdir) on my backup server:

[code]rsync -e ssh -rv test1.php

sending incremental file list
rsync: mkstemp “/.backupdir.qYm3nu” failed: Permission denied (13)
sent 3946 bytes received 31 bytes 126.25 bytes/sec
total size is 3871 speedup is 0.97
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1060) [sender=3.0.7][/code]

I also tried to copy a small directory (sourcedir) from my server to a directory (/backupdir) on the backup server:

[code]rsync -e ssh -rv sourcedir

sending incremental file list
rsync: mkdir “/backupdir” failed: Permission denied (13)
rsync error: error in file IO (code 11) at main.c(594) [receiver=3.0.3]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]

So no luck either. In that second case I made sure no /backupdir existed before execution, and the root directory of the backup server is set to 710. myuser and mybackupserver represent the backup server and username from DH.

Note, these commands do work for me if I don’t specify /backupdir at the end of the commands - but I want to backup to a directory on the backup server, not to the root.

Could someone please suggest what the problem is/could be? Many thanks.



Remove the leading slash on “/backupdir”. The leading slash is directing rsync to try to write to a directory called “backupdir” on the root level of the backup server’s filesystem (i.e, outside your home directory).


Many thanks Andrew. I will try that.



Yes, that did the trick, thank you - in fact I also needed to add a trailing slash after the destination directory name (otherwise it fails as it is trying to copy all files from the source directory into a single destination file), so in case it helps anyone in the future, the working syntax for me was: