OK... <takes deep breath>... I've just tried this and made a few notes! It's not perfect though!
1. Install cygwin on your windows PC, following through the setup wizard, which you can get from here
- when prompted by the installer, select Install from internet, accept the default settings
- when prompted for a local package directory, enter something like c:\packages
- choose a suitable mirror geographically near you
- At the select packages screen, select the following to install
Net -> openssh
Net -> rsync
Then click Next and follow through the rest of the setup
2. Configure cygwin's openssh server as follows:
- Start a bash shell from the windows machine. This is found under Start Menu -> Programs -> Cygwin -> Cygwin Bash Shell.
Under Vista/W7 You MUST right click on this and select Run as Administrator from the menu
and answer questions as follows:
Should privilege separation be used? no (yes may be more secure, but might give problems if you want free reign to back up stuff)
Do you want to install sshd as a service? yes
Enter the value of CYGWIN for the daemon: ntsec
Do you want to use a different name? no
Create new privileged user account 'cyg_server'? yes
Please enter the password: <your choice>
Reenter: <same choice>
3. You will probably also need configure the windows firewall to allow SSH connections.
In Vista, you can start the Firewall configuration by searching for Firewall in the start menu. You want "Windows Firewall Settings".
On the Exceptions tab, click on "Add Port", enter "SSHD" as the name, and 22 as the port number. The protocol is TCP. Then click OK
Personally, I'm more a Linux man than a Windows man, so I'm a little hazy on Windows permissions, so you might have to fiddle a little with windows user accounts to get things to work properly for your backup.
4. Set up public key authentication between the 2 boxes.
The idea here is that both machines can log in to each other without a password. If you need help with this aspect, just let me know. But basically, it's like this:
a. On the Linux box, as the user from which you will be performing the rsync (ie the user which pulls data from the windows box):
(accept the defaults, blank passphrase)
b. Get the public key, and copy it to the clipboard:
(then copy the resulting text to the clipboard)
c. On the Windows box, logged in as the user you will be pulling data from, start a Cygwin bash session
d. Create the directory .ssh and change to it:
e. Create a file "authorized_keys", by using echo, as no other editor is probably installed:
echo "<paste public key here>" >> authorized_keys
or if that's complicated, just do
and paste in there
f. From the Linux machine, test you can log in without a password. This is essential for unattended backups.
ssh <IP address of Windows Machine> -l <username on windows machine>
The first time you will get a message warning you that the authenticity of the new host can't be established.
This is perfectly normal, you'll only see this once. Say "yes".
5. Perform an rsync
Now you are ready to try an rsync!
For this step, bear in mind that the local PC c: drive is accessible from within the Cygwin bash shell as /cygdrive/c/
So the syntax goes something like this, this example is run from the Linux machine (replce with your own details):
rsync -az firstname.lastname@example.org:/cygdrive/c/Users/neil/ backups/
On my setup, this will back up the whole of my User directory to the backups/ directory on my linux box
When you have this command working as you want, you can then automate it via cron.
This also works the other way round of course, from the Linux box to the windows box.
You would just have to sort out public key authentication the other way round, and then reverse the last 2 parameters of rsync
I hope that helps you, sorry it's not perfect, but hopefully it will get you started.