How do I pull a backup from a Linux server to my Windows PC using rsync?
Solution 1
Use the built-in rsync on the *nix box, and DeltaCopy on the Win32 box.
Solution 2
I was able to get this working with cygwin's rsync and ssh. Here's the command I ended up with:
C:\cygwin\bin\rsync.exe -vcr -e "ssh -l username -i /cygdrive/C/Backups/sshkey" "myserver.com:/home/username/backups/" "/cygdrive/C/Backups/rsync/"
Here were some issues along the way: Added C:\cygwin\bin\ to my Windows PATH. I don't know if this was strictly necessary, but it helped me.
Chris S's link to create the key pair that's needed to allow ssh to connect without using a password.
I also needed to set some permissions of the newly created .ssh directory and file on the server...
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys/
Oh, and I needed to manually locally create ~/.ssh within cygwin.
Related videos on Youtube
Nogwater
Updated on September 17, 2022Comments
-
Nogwater over 1 year
I'm currently using sftp to download nightly backups (.tar.gz) from my web host to my desktop computer. I think I'd like to switch to rsync to minimize the bandwidth (and time). I have cygwin installed on my PC, but don't use it for much. I have shell access to my web host via ssh (PuTTY).
Let's say my source directory is myserver.com:/home/username/backups/, I want to grab all of the .tar.gz files from there, and I want to save them to C:\Backups\ locally.
-
Nogwater almost 14 yearsActually, I tried DeltaCopy, but it wasn't able to connect to the remote server. Do you know how to get it to connect over ssh?
-
Philip almost 14 yearsIn the DeltaCopy Client, setup the remote server as you normally would, and under the options tab make sure 'Connect via SSH' is checked. You must have SSH keys setup so it can connect without a password. There's little guide here: aboutmyip.com/AboutMyXApp/DisplayFAQ.do?fid=1 NOTE: it says it's for moving file to *nix only, it means that it's for connecting to a *nix daemon only.
-
Nogwater almost 14 yearsOh SSH keys, I'll need to find out if that's possible with my host. I'll let you know how it turns out. Thanks for the pointers.
-
Nogwater almost 14 yearsThanks for the pointer. I ended up not using DeltaCopy, but your link definitely helped me get pointed in the right direction.