How to: cwRsync 5.0+ GUI, rsync on windows

We have been using rsync from windows machine for many years now. Thanks to itefix for providing this unix based tool on windows. This article show how to use cwrsync GUI to transfer (sync) files from your local computer to the remote host and batch it.

Update: cwrsync 5.0.1 now have support for interactive password.

First up get cwRsync from itefix website. Choose your license wisely.

https://www.itefix.no/i2/node/12990

These guys have put a lot of effort in creating this tool so supporting them is a good idea.

Ok now lets get to the point, so I assume that you bought your license and ran cwRsync_5.0.0_Installer.exe on your windows machine. I ran this installer on Windows 7 without any problems.

Now goto Start > cwRsync > cwRsync GUI

You will get a screen as shown below:

Now that you have this screen open you can now click on button called local make sure that the tab opened is called “Source“. Now select a folder or file that you would like to sync with the remote host as shown below

 

As you see that you can also select source as your remote server but we are looking at putting or syncing files from our local machine to remote server so we will concentrate on that. Now that you’ve selected the folder that you would like to sync now click on “Destination” tab you will get a screen similar to one shown below.

Now Click on the “Remote Server” button. You will get a prompt as shown below:

 

Now enter the user and server details and path on the server where you would like to sync files to.

On a side note please make sure that you put C:\path_to_cwRsync_install_folder\bin in your environment “Path” or review the resultant Batch file to see if the path has been setup correctly. Because when you run the command that you are preparing then the command looks for ssh.exe file that’s in bin folder of your cwrsync install folder.

You can set filter options from filter tab. Here are the Filter rule prefixes

  • exclude
  • include
  • dir-merge
  • hide
  • show
  • protect
  • clear

read more about these filter rules here: http://linuxcommand.org/man_pages/rsync1.html

Set Options from the Options tab. I want to compress my file data during the transfer so I’ve ticked that options as shown below

Now goto the Run Tab and click Batch button as shown below

 

 

Now go to the folder where you’ve saved the batch file to. Double click on test.bat file and you will see a screen similar to the one shown below

Enter the password on the screen and you’re done. If the path is valid on the remote server then you will see that folder from your local drive is copied to your remote server destination folder.

Now as you see that there is a requirement of entering the password in that batch.

If  you do not want to enter a password when you run this bat script then do the following:

Run putty key generator you can download it from here http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe

when you run the above exe you will get this screen

Click on Generate button. After you move your mouse over the blank area for few seconds you will end up with this screen

Now the keypair has been generated, but they exists only in PuTTYgen’s memory, it has to be saved to disk to be of any use. For your information the public key has no sensitive information and will be installed on remote systems, thus no need to worry about that, the private key is the one you should be concerned about, private keys should always be kept at safe place. They are the key to you server.
The private key is typically protected with a passphrase, and this phrase is entered twice in the fields indicated. Do not put a password to your private key. Click on Save public key and save it as pubkey.txt to a desired location

now click save private key button and save the key with extension .ppk. Close the program.

Public key looks like this

—- BEGIN SSH2 PUBLIC KEY —-
Comment: “rsa-key-20120116”
AAAAB3NzaC1yc2EAAAABJQAAAQEAgfjbLWqeCnsuklM35ABGONcEy3tuGEjEo7d+
OZFHC43m35n0eqqXCWB6yJOwnwrmQt9MP9VEyLY7PYB38361qoQOzpQitEwl6G+Y
s/BzpeYc+IH2tTpTlKmKSPlOHV166R0hwn3YOdfBgnSs1foisK6G017q3MvgO0Cq
1ZBBpbHsXhmOnssrNzIx+PbKEsLQIY14UF559oYX9fBEDHDIPSV9S3E8lF/FUEC1
o7OLLTOSUoUJUoGpst9SxevptolUqZ4ksyJC2KNGLYn4LDsCemtFh2pKARG7TS0F
qWaViHDwUfMG36qgFrrRm1s143lNhCEfEL45t2wJpzqZwf3Dow==

—- END SSH2 PUBLIC KEY —-

With puttygen still open, highlight the entire “Public Key for pasting into OpenSSH authorized_keys file” area and Right Click > Copy to the local system’s clipboard. This data is specifically to be used on the Linux system other than that its pretty much the same data as you saved to your public key
Login to the Linux computer using the account’s password, create the .ssh directory (most commonly its always there), then edit the file .ssh/authorized_keys. This will be a text file, and the clipboard should be pasted into it.
The public key will be just one long line, and it’s really easy to paste the data in a way which truncates the first few characters. This renders the key inoperable, so be sure that the key begins ssh-rsa or ssh-dsa.

Make sure that all files under .ssh folder are readable by current Linux user.

Ok so the server part is done now. Now go to you cwrsync installation folder and launch Secure Channel Wizard by double clicking SecureChannelWizard.exe

You will get this screen

 

 

 

Enter the cwRsync server name.

Under rsync command enter the command that you saved previously in your batch file. You must enter the command without the resync.exe part.

You may need to put this switch -e /cygdrive/c/cwrsync/cwRsync/bin/ssh.exe to locate ssh.exe.

You’re almost done. Click next and copy the text under “Batch file example to run your ….”. Open notepad, paste this text there. Save the file as .bat or .cmd. Now when you run this batch file your rsync command should work without password. It could be pain to get it right the very first time but I am sure you will find the way.

This article serves only a starting point to get the job done there are so many other things to explain but are not directly applicable to this article. Please share your experiences with other users if you would like.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.