Have you ever had the need to do an rsync from a Linux box to a Windows machine and googled around, tried it with cygwin, but you didn't want to install the whole cygwin environment. Well I have a solution just for you. The guys from ITeF!x put together a perfect packages, containing all the cygwin dependencies in a single easy to install package for Windows called cwrsync.

In our tutorial setup we will have a Windows Box with IP x.x.x.x which isn't important, and a Linux Box with the Ip address

Step 1 - Download / Install

Go to http://www.itefix.no/i2/cwrsync and download cwrsync Installer from the sourceforge mirror (we are not going to use the cwrsync server). Install it using the default locations.

Step 2 - Create certificates

Next we will have to create server certificates on the Windows Box, therefore open up a command line and do the following. In this example I am logged in as Administrator.

cd c:\Users\Administrator
mkdir .ssh
cd .ssh
"C:\Program Files\cwRsync\bin\ssh-keygen.exe" -t rsa -N "" -f id_rsa

Now copy the created id_rsa.pub to your Linux Box to /root/. Connect to your linux box and add the public key of the Windows Box to the autorized_keys file. Therefor do the following.

root@linuxbox:~$ cat id_rsa.pub >> /root/.ssh/authorized_keys

Step 3 - Execute the batch file for the first time

Here I provide you with a simple batch file, for starting cwrsync the first time, and sync data from your Linux Box to the Windows Box.

REM *****************************************************************
REM Backup cwrsync script
REM *****************************************************************

REM Make environment variable changes local to this batch file

REM ** CUSTOMIZE ** Specify where to find rsync and related files (C:\CWRSYNC)

REM Set HOME variable to your windows home directory. That makes sure
REM that ssh command creates known_hosts in a directory you have access.
SET HOME=c:\Users\Administrator\

REM Make cwRsync home as a part of system PATH to find required DLLs

rsync -trzv -p --chmod=ugo=rwX root@* /cygdrive/c/BackupData/

Useful Links

Download cwRsync_4.2.0_Installer