Loading...
 

Install rsync on Windows smoothly


Since rsync was designed for Unix/Linux/BSD systems, to run rsync on Microsoft Windows, the Cygwin package is necessary to provide the expected system interfaces, or Microsoft's SFU (Services for Unix) package. A few package combinations are available that include rsync, cygwin, and an installer, making it easier and more familiar to Windows users. (Wikipedia, see source and links).

I've tried DeltaCopy with some success, details follow.

Download


Download DeltaCopy:




General configuration


Install the program following its instructions.

The included rsync version is 2.6.6, which does not support interesting options like changing the permissions of the transferred files. If you want extra features, consider upgrading the installed rsync.exe with the one in the following archive, version 2.6.9:

  • <kbd><a href="../wikifiles/rsync_269.zip">rsync_269.zip</a>
<small>(297 kB 2008-09-15 14:53)</small></kbd>

The program instructions say that the local rsync service must be running even if you want to use it as a client only, but I'm not sure of this very much. It worked for me even with the service off. The program seems to be just an interface to the cygwin utility rsync.exe.

If you want to use this program as a client only, to transfer files to a remote server, you can try just jumping to the next paragraph.

Otherwise:

  • Execute "DeltaCopy Server".
  • When you first run DeltaCopy Server, it will ask you to register the server as Windows Service.
  • After registering the service, click the "Start Server" button to run the program as Windows Service. If you get an error, it probably means that the authorization to run it was not properly set. See below how to configure system services to fix this, and continue.
  • Next, create virtual directories on the server, in case you want to enable the Windows machine to host rsync repositories. To run simply as a client to rsync to a remote machine, this is definetely not necessary.

In case you need modify the system service settings:

  • Run Start > Settings > Control Panel > Administrative Tools > Services
  • The rsync service is called 'DeltaCopy server'. Right click and 'properties'.
  • On the 'LogOn' tab you can configure which accounts will run it, or set is as a Local System account. I guess this is the most global behavior.


ssh configuration


In principle this rsync interface is intended to synchronize files with a server where a special daemon is running (rsyncd), serving some directories as "virtual" repositories.

You can also synchronize files with a server that runs no daemon at all and in which you have an user account, as long as the server also has rsync installed and allows ssh connections.

If you want ssh support you need some extra cygwin executables. Add the contents of this archive to the program installation directory on Windows:

  • cygwin ssh extra utils: <kbd><a href="../wikifiles/ssh_win.zip">ssh_win.zip</a>
<small>(2536 kB 2008-09-15 14:54)</small></kbd>

This archive includes the files that must be in the same directory as the rsync application in order rsync-ssh to work. Namely: ssh to do the transfers, and some dll's for the encryption and compression. This will work even if you do not have cygwin installed.

To make it work smoothly, ssh keys must be generated locally for each different Windows user and transferred to the remote server as explained in Scp Batch Mode, otherwise a password will be asked stoping the execution. That's why also ssh-keygen is included in that package.

To transfer the generated keys to the server you may want to use scp, which is also included, but this will require a trick for running if you do not have cygwin already installed: create a diretory \usr\bin, and copy there ssh.exe (that's the location where scp expects ssh to be).

In the Scp Batch Mode instructions you can read that the remote authorized_keys file must be read/writeable only by the owner. The same applies to the private key that remains in your local computer after it's generated by ssh-keygen (the one without the .pub extension). In case you have problems concerning that file permissions, you can use chmod (also included) to change them to 600 with chmod 600 ~/.ssh/id_dsa or something like that.

All that should be enough to directly run rsync.exe, but you would have to learn how to use it and apply the correct options and directory syntax. To avoid that, programs like DeltaCopy act as an user-friendly interface. In any case what they basically do is building the options up to pass them to rsync.exe. Keep reading, but don't be surprised if after a while you decide not to use DeltaCopy at all and include a call to rsync.exe with all the necessary options in a .bat file that you can launch directly. (See Rsync Sils for an example).

After all this, we are ready to configure the DeltaCopy client and start tranferring.

Client configuration


  • Execute "DeltaCopy Client".
  • Create a new profile. A Profile in DeltaCopy is a group of files that you want to backup together
    • Profile name is just a tag, type something descriptive.
    • Server name may include a specific user, as in user@remote.server.com. This is surely necessary if you want ssh transfers.
    • In the ssh case, there's no virtual directory: type here a real system directory in the server where to put the files.
    • Otherwise virtual directory is a remote repository directory. Clicking on ... should return a list of the existing ones in the server. Select one. If you want to use a subdirectory on it, it must exist beforehand, it won't be created automatically.
    • Test the connection (only works with a rsync daemon, not ssh), and end with 'Add Profile'.
  • To add file/folders to synchronize, drag them from Windows Explorer on to the listbox or click the add File/Folder buttons.
  • Assign a schedule for the profile. DeltaCopy is integrated with Windows Scheduler. This means that your login account must have enough permission to create Scheduled Tasks on the machine.
  • Configure extra options. See below.
  • If you want ssh transmissions, check this option. If you configured it properly as explained above you won't need any password now.
  • Otherwise, if the remote rsyncd daemon in the server requires a password, this must be set as an environment variable. To do this:
    • Execute Start > Settings > Control Panel > System (or press Window + Pause)
    • Go to tab 'Advanced' and click the 'Environment Variables' button
    • Add a new 'System variable', named RSYNC_PASSWORD, with value the necessary password.
    • Save with 'OK'.
  • An alternative way to set the password is to use the --password-file=FILE extra command line option for rsync.

Extra options


Typical additional parameters for a backup system are -a --backup --exclude core.

To move files to the remote directory (i.e. delete them locally after the transfer) you use the option --remove-sent-files.

If you want to change the permissions of the transferred files (only with rsync > 2.6.6, remember to upgrade your executable if you want this) you can use the -p --chmod options. For example, to let everybody in the remote server access the transferred files use -p --chmod=ugo=rwX.

Run


You can test the profile by right clicking on it and doing 'Run Now...'.