rsync from Centos to Windows Server 2008R2 with Cygwin

I want to rsync my files from a local CentOS Server to a remote Windows Server 2008R2 Box.

Windows = no sshd, no rsync  🙁

First thing = Install the Cygwin Package

LINKInstall Cygwin

Setup an SSH Server in Vista (works with Win Server2008R2):

LINK: https://www.petri.com/setup-ssh-server-vista

Install also the rsync package:

Unfold Packages: Net and double click on rsync

It will take some time to download and install the packages.

 

Next Steps:

configure your SSH Server (Howto see the Link above :Setup an SSH Server in Vista

———————————————————————-

generate key pair for ssh remote login without a password.

Login into your REMOTE Server

generate keys:

#> ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/remotix/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/remotix/.ssh/id_rsa

Your public key has been saved in /home/remotix/.ssh/id_rsa.pub

#> cd ~/.ssh

#> cat id_rsa.pub >> authorized_keys

#> chmod 600 authorized_keys

Do not enter a passphrase !

copy the id_rsa  file to your LOCAL CentOS machine (with scp, or open two different terminals and cat /home/remotix/.ssh/id_rsa and paste into the local file ~/.ssh/id_rsa)

#> cd ~/.ssh

#> chmod 600 id_rsa

TEST it with ssh

ssh -i ~/.ssh/id_rsa user@remote-server

You should be able to login without password.

———————————————————————-

    3.  create the rsync command

local dir = /tmp/myData

remote Server = REMOTIX

path to the id_rsa keyfile = /root/.ssh/id_rsa

rsync -azh /tmp/myData/ -e ’ssh -i /root/.ssh/id_rsa‘ root@REMOTIX:/my/RemoteData/

you can add the –stats option at the end of the command for detailed informations

rsync -azh /tmp/myData/ -e ’ssh -i /root/.ssh/id_rsa‘ root@REMOTIX:/my/RemoteData/ –stats

Number of files: 28
Number of files transferred: 0
Total file size: 26.63M bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 1.31K
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 1.33K
Total bytes received: 17

sent 1.33K bytes received 17 bytes 898.67 bytes/sec
total size is 26.63M speedup is 19755.13