Help in putting together RSYNC for Windows
Links to sections below:
RSYNC is a program for copying files between networked computers. It is "special" because if the same file already exists, it copies only the differences between the files, therefore saving network traffic. Thus, you can make a mirror copy of a hard drive, and keep the two copies identical, over a modem link.
rsync is fairly straightforward for Unix machines, but if you want to
use it with Windows as well, it's a nightmare. This is a detailed
guide to getting RSYNC running on Windows and Unix systems. It is
motivated by my own frustration in achieving a working system,
frustration borne mainly from a lack of detailed documentation. There
is some (very helpful!) documentation already, but it took me a long
time to sift through it and work out what was needed, what worked,
what didn't. I wanted only the bare minimum so that colleagues could
take advantage of it with minimum hassle.
Why did I bother? I wanted to:
- Keep a mirror image of my desktop hard drives, to quickly recover
from disk crashes.
- Bring my desktop, notebook and server file sets into sync
with each other, and keep them that way.
Both of these things can be done in other ways, but rsync seems to
have some advantages, particular when syncing a notebook to a remote
server, which is something I do every night after hours of working on,
say, a Powerpoint presentation.
-
Installation guide for rsync on Windows
This is a very detailed companion document to help users install rsync on their windows machines.
-
rsync package
This is a package including ssh and rsync for use on Windows. It includes ssh 1.2.26 and rsync 2.4.1, and a howto document.
For other information, look at:
For software referred to below:
The basic idea I have adopted is to have RSYNC running on a special
(Linux) file server, and for desktop/notebook/workstations to send their files
there. Note that I have not tried to use a Windows box as a server,
although that is possible (see rsync on NT by Mike Henry).
rsync can communicate in two ways: using a remote shell (rsh or ssh),
or with its own internal protocol, loosely referred to as "rsync
server mode". I now have both of these working, thanks to specific
updates by Dave Dykstra (thanks!), and both are documented below.
However, server mode is more hassle for multiple users, and less
secure, so I recommend taking the extra time to get ssh working.
Install ssh on your Unix/Linux rsync server.
- Get ssh version 1.2.27. While versions 2.x probably have
advantages, they are not freeware. They are also more difficult to
compile and run for Windows machines.
Download ssh-1.2.27 source from any gnu site, for example
Australia.
Once you have untarred it, you just need to (as root):
./configure
make
make install
sshd
You should also make sure that sshd is started automatically,
e.g. with a line in your rc.local script.
-
Create the necessary security keys on the server. Log in as a
regular user and:
ssh-keygen -P "" -f ~/.ssh/identity
For added security, you can use passkeys, but empty passphrases are probably fine for
most of us.
I have written a short script so that users can do this trivially. See dossh.
This is better documented in Installation guide for rsync on Windows. Here I include a little more detail if you need to do it yourself.
-
Use ssh version 1.2.26. Huh? Yes. Compiling ssh on a winbox is a
pain. You can get a precompiled version of both 1.2.26 and 1.2.27,
but the latter needs a special version of cygwin1.dll, and gave
me various forms of grief. 1.2.26 works just fine.
- download ssh-1.2.26 binaries from
Sergey Okhapkin
or (generally better) from his mirror.
I suggest extracting the essential files and putting them into a new directory, c:/rsync. Essential files are ssh1.exe and ssh-keygen1.exe and possibly (?) scp1.exe.
- dowload cygwin1.dll from Cygnus and put it in c:/rsync. Jump to one of the listed mirror sites and Look for cygwin-b20/cygwin1-???.dll
- create a fake password file. This is described in the very
helful document Compiling rsync for windows 95 by Anthony Wesley.
Basically, create a file /etc/passwd that contains one line:
scholten:x:1:10:Robert Scholten:/rsync:/bin/sh.exe
where only the username (first entry) and home directory (6th entry, /rsync in the above) are significant.
- Create local security keys:
You will be asked Enter file in which to save the key (/rsync/.ssh/identity):, just hit Enter.
- Copy the identity.pub file (in /rsync/.ssh if your home
directory is /rsync as specified in /etc/passwd) to the rsync
server Unix system ~/.ssh/authorized_keys file (where ~ is the
home directory of the regular user referred to in step 2 above).
Append to authorized_keys if you have other keys there.
- Try ssh.
At this point, you should be able to log in to the remote rsync
server from your windows box, using ssh. Try it. From an MS-DOS
command window, or an NT command window:
You will probably be told that your windows box is not authorized,
and asked if you want to add it. Yes (all three letters, y, e, s).
If you are asked for a password, something is wrong; please read
the (dreadful) ssh documentation.
Install rsync on the Unix rsync server. This is generally
straightforward. You probably should get the latest (devlopmental,
i.e. beta) release, particularly because there are a number of bugs in
the latest formal release (2.3.2) relating to windows and to using server
mode. Look for
rsync beta.
Once you have it, as root:
./configure
make
make install
You can simply run rsync as a daemon, or
you can have it started automatically by
inetd. In /etc/services add:
and in /etc/inetd.conf add:
rsync stream tcp nowait root /usr/bin/rsync rsync --daemon --config=/etc/rsyncd.conf
- You can compile your own trivially, if you have the full cygwin
development suite installed (great stuff!). Download from Cygnus. Jump to one of the listed mirror sites and look for cygwin-b20/full.exe.
Alternately, download my own precompiled binary
- Test it.
On the windows box, try:
set CYGWIN=tty binmode
set PATH=/rsync;%PATH%
rsync -e ssh -av "\\d/" unixbox:/rsync
Note that the path must be set to include wherever you put your
ssh.exe.
- Problems
- Don't use the -x option from a windows box. Strange things happen.
- Try -vvv if it hangs. This was essential with rsync 2.3.2, but
the development version seems to have fixed it.
To get latest rsync, assuming you have a working rsync already:
rsync -av rsync://rsync.samba.org/ftp/unpacked/rsync .
This will get the latest *development* version of rsync. To install:
chown -R root:system *
./configure
make
make install
In my case, I don't do the latter: I copy rsync to /usr/local/bin/rsync-2.4.2 and link it (version number changes of course).
Created: 5 January 2000
Updated: 1 February 2000
Maintainer: Robert Scholten, School of Physics, Email: r.scholten at physics.unimelb.edu.au
Authorised by: Robert Scholten, School of Physics, Email: r.scholten at physics.unimelb.edu.au
This page, its contents and style, are the responsibility of the author and do not represent the views, policies or opinions of The University of Melbourne.