3

I've got a problem with my previously working backup-script.

In short it simply calls duplicity and orders it to copy files via rsync to a NAS.

However when I now start my script, it returns always a permission denied Error.

I've narrowed it down to rsync not working as I thought it would.

In my test setup I now execute the following code:

rsync -av test/ remoteuser@nas.domain.com

What happens is that in the current directory a folder called "remoteuser@nas.domain.com" is created and rsync syncs the files from test into that new folder. If I append the target-directory on the remote (...:/home/remoteuser/backup) it returns the previously mentioned "Permission denied" error

Permission denied, please try again.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]

Connection via ssh to my nas works without a problem btw.

Webfarmer
  • 263
  • 4
  • 15
  • It can't determine the target is a system to connect to because you've not used the usual `:` at the end. – Anya Shenanigans Apr 23 '15 at 09:11
  • If I do, this is the error I get: Permission denied, please try again. rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1] – Webfarmer Apr 23 '15 at 09:34
  • 1
    Try as `rsync -e -e "ssh -v" -av test/ remoteuser@nas.domain.com:` - it sounds like you've got an ssh access issue to the remote system (e.g. keys being provided by an agent on the desktop, but when run in a script it doesn't have access to the key). – Anya Shenanigans Apr 23 '15 at 09:39

1 Answers1

1

Thanks for your suggestions, but I have found the solution:

Rsync needs to run on both the client and the server to be able to sync files. I've checked if rsync was installed before, and it was. But when I tried to copy on the NAS with rsync a testfile locally, I got an error that the service was not running.

I found out that for some unknown reason it is needed to pass the path to rsync as option in the call as following:

rsync --rsync-path=/usr/syno/bin/rsync ...

Now the script works again!

As a sidenote: Since I use duplicity I had to write my full command as following:

duplicity --rsync-options="--rsync-path=/usr/syno/bin/rsync" ~ rsync://remoteuser@nas.domain.com:/home/remoteuser/backup
Webfarmer
  • 263
  • 4
  • 15
  • 1
    That's a known reason - it's because the remote side rsync is not in a standard location. In future, for questions like this you're better off asking on superuser.com as it's not actually a programming question – Anya Shenanigans Apr 23 '15 at 10:06
  • Yes, i realised that after I've written the question :/ – Webfarmer Apr 23 '15 at 11:46
  • to me this does not solve. the real problem is that you have to put : after user@server as @Petesh said. – gdm Feb 27 '21 at 11:23