2

I'm trying to backup my Raspberry Pi 3 (Raspbian) to my desktop computer (Windows 10 Pro). At the moment I can SSH each way, specifying the private key file.

To SSH into the RPi from Windows: ssh root@192.168.1.107 -i H:/ssh/BB8.OpenSSH.ppk (root to make sure I don't have permissions errors during testing).

To SSH into Windows from the RPi: ssh matt@192.168.1.100 -i /home/pi/.ssh/RPi3.OpenSSH.ppk

The following rsync command is not working: (Windows > RPi)

rsync -vvvvna --exclude={"/proc/*","/sys/*","/dev/*","/boot/*","/tmp/*","/run/*","/mnt/*"} -e "ssh -i H:/ssh/BB8.OpenSSH.ppk" root@192.168.1.107:/* /cygdrive/h/Users/Matt/Documents/RPi3_Backup

Rsync says that the "connection unexpectedly closed", while the RPi SSH logs says that it "received disconnect from 192.168.1.100".

Rsync output:

cmd=ssh -i H:/ssh/BB8.OpenSSH.ppk machine=192.168.1.107 user=root path=/*
cmd[0]=ssh cmd[1]=-i cmd[2]=H:/ssh/BB8.OpenSSH.ppk cmd[3]=-l cmd[4]=root cmd[5]=192.168.1.107 cmd[6]=rsync cmd[7]=--server cmd[8]=--sender cmd[9]=-vvvvnlogDtpre.iLsfxC cmd[10]=. cmd[11]=/*
opening connection using: ssh -i "H:/ssh/BB8.OpenSSH.ppk" -l root 192.168.1.107 rsync --server --sender -vvvvnlogDtpre.iLsfxC . "/*"  (12 args)
msg checking charset: UTF-8
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
[sender] _exit_cleanup(code=12, file=io.c, line=235): entered
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.2]
[sender] _exit_cleanup(code=12, file=io.c, line=235): about to call exit(12) (DRY RUN)
rsync: safe_read failed to read 4 bytes [Receiver]: Connection reset by peer (104)
[Receiver] _exit_cleanup(code=12, file=io.c, line=276): entered
rsync error: error in rsync protocol data stream (code 12) at io.c(276) [Receiver=3.1.2]
[Receiver] _exit_cleanup(code=12, file=io.c, line=276): about to call exit(12) (DRY RUN)

/var/log/auth.log:

May 27 20:01:20 raspberrypi sshd[9928]: Accepted publickey for root from 192.168.1.100 port 56787 ssh2: RSA SHA256:bYwS/mZ7XYmMlim3gEaSxZ+p22wU3i0NypvFj6ZPPAA
May 27 20:01:20 raspberrypi sshd[9928]: pam_unix(sshd:session): session opened for user root by (uid=0)
May 27 20:01:20 raspberrypi systemd-logind[476]: New session c33 of user root.
May 27 20:01:20 raspberrypi systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)
May 27 20:01:20 raspberrypi sshd[9928]: Received disconnect from 192.168.1.100 port 56787:11: disconnected by user
May 27 20:01:20 raspberrypi sshd[9928]: Disconnected from 192.168.1.100 port 56787
May 27 20:01:20 raspberrypi sshd[9928]: pam_unix(sshd:session): session closed for user root
May 27 20:01:20 raspberrypi systemd-logind[476]: Removed session c33.
May 27 20:01:20 raspberrypi systemd: pam_unix(systemd-user:session): session closed for user root
4

Typical - as soon as I post here I resolve the problem (which persisted through dinner and hours of debugging...)

The OpenSSH server that can be enabled as an optional Windows 10 feature doesn't seem to play nice with Cygwin's rsync. I installed OpenSSH through Cygwin and everything connects as expected.

rsync -nva --exclude={"/proc/*","/sys/*","/dev/*","/boot/*","/tmp/*","/run/*","/mnt/*"} -e "C:/cygwin64/bin/ssh.exe -i /cygdrive/h/ssh/BB8.OpenSSH.ppk" root@192.168.1.107:/* /cygdrive/h/Users/Matt/Documents/RPi3_Backup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.