SSH key working for ssh, not for rsync

Issues related to applications and software problems
Post Reply
stefansaeys
Posts: 4
Joined: 2015/06/19 21:26:02

SSH key working for ssh, not for rsync

Post by stefansaeys » 2017/10/10 21:47:51

I’m trying to rsync two folders between CentOS 7 and QNAP without using a password with cron.
What seemed to be a relatively straightforward process, turned out to be not as easy as expected.

Although I’ve managed to setup ssh correctly, I can’t get rsync to work in the same way.
ssh admin@server.example.com connects to the QNAP without password.
rsync -av /myfolder rsync://admin@server.example.com:/BACKUP/myfolder/ works but requires a password.

Using
rsync -av /myfolder admin@server.example.com:/BACKUP/myfolder/
returns:
sending incremental file list
rsync: mkdir "/BACKUP/server.example.com” failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(871) [Receiver=3.0.7]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]

CentOS is using root (after su over ssh with other user)
QNAP user is admin

Obviously I am missing something, but have no clue.
Any help appreciated.

pjwelsh
Posts: 2632
Joined: 2007/01/07 02:18:02
Location: Central IL USA

Re: SSH key working for ssh, not for rsync

Post by pjwelsh » 2017/10/11 18:20:22

rsync -av /myfolder rsync://admin@server.example.com:/BACKUP/myfolder/
will use the rsync daemon. For ssh rsync you want:
rsync -av /myfolder admin@server.example.com:/BACKUP/myfolder/

stefansaeys
Posts: 4
Joined: 2015/06/19 21:26:02

Re: SSH key working for ssh, not for rsync

Post by stefansaeys » 2017/10/11 19:25:02

Thx for the reply.

That was exactly what I've tried earlier and gave me following error:
rsync: mkdir "/BACKUP/server.example.com” failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(871) [Receiver=3.0.7]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9][/i]

However, trying again to run the same command gave me the following error:
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)
rsync: write failed on "/BACKUP/server.example.com/backup/filename.zip": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7]
rsync: connection unexpectedly closed (31 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]

As my storage capability was more then sufficient, I've discovered that I was trying to copy to the wrong location on the QNAP.
I've changed the command to:
rsync -av /myfolder admin@server.example.com://share/BACKUP/myfolder/

and it worked.
It is still unclear to me why it gave another error before.

Anyway, thx for your help.

Post Reply