How to regularly backup Windows XP to Ubuntu, using rsync

Back in September I revived my MiniITX box to serve as a backup server. I set up BackupPC, ran it once, it seemed to work, and then ignored it for weeks. When I checked back, it hadn’t run successfully since. Ugh, I want backups to just work!

A few nights ago I decided to try again, this time dropping the constraint of not installing software on my laptop. Turns out I already had the building block I needed: rsync, installed in the form of Cygwin.

I began with these Rsync for Windows instructions, and everything went smoothly until the very end—rsync on Windows wasn’t connecting to rsync on Ubuntu. My gut told me rsync’s port 873 isn’t open on Ubuntu, but I had no idea how to open ports anymore. Luckily I found How to start rsync daemon at boot in the Ubuntu forums which told me exactly what I needed to know.

Partly as an aide to my memory, and partly to help anyone out there who might be struggling with the same project (unless everyone except me is already backing up their computers) I decided to summarize the process without all the false starts and dead ends it took me to figure it all out. For more information, the rsync man page is useful, as well as the results in Google for windows rsync.

Set up rsync server on Ubuntu

  1. Run <font style="background-color: #eeeecc" size="3">sudo apt-get install rsync</font> (it’s probably already installed)
  2. Create a file named rsyncd.conf in /etc
    1. sudo nano /etc/rsyncd.conf
    2. Add the following to rsynd.conf, replacing all instances of <strong><font style="background-color: #eeeecc" size="3">username</font></strong> with your Ubuntu username:
      [<strong>username</strong>backup]      path = /home/<strong>username</strong>/backup     comment = Backup     uid = <strong>username</strong>     gid = <strong>username</strong>     read only = false     auth users = <strong>username</strong>     secrets file = /etc/rsyncd.secrets
    3. sudo chmod 644 /etc/rsynd.conf
  3. Create a file named rsyncd.secrets in /etc
    1. sudo nano /etc/rsyncd.secrets
    2. Add the following to rsyncd.secrets, replacing <strong><font style="background-color: #eeeecc" size="3">username</font></strong> with your username and <strong><font style="background-color: #eeeecc" size="3">password</font></strong> with a password of your choosing:
      <strong>username</strong>:<strong>password</strong>
    3. sudo chmod 600 /etc/rsyncd.secrets
  4. Open rsync port by editing /etc/default/rsync and setting
    RSYNC_ENABLE=true
  5. Restart rsync
    sudo /etc/init.d/rsync restart

Set up rsync client on Windows

  1. Install Cygwin, making sure Editors > nano and Net > rsync are selected
  2. Add <font style="background-color: #eeeecc" size="3">C:\cygwin\bin;</font> to the Windows PATH statement
    1. Right-click on My Computer and select Properties
    2. Switch to the Advanced tab and click the Environment Variables button at the bottom
    3. Find the “Path” or “PATH” variable in the System variables list at the bottom and click Edit
    4. Add <font style="background-color: #eeeecc" size="3">C:\cygwin\bin;</font> to the beginning of the list
  3. Create secret file to store password in Cygwin
    1. Start Cygwin Bash Shell
    2. Create secret file in the filesystem root and enter only the password in rsyncd.secrets above, with no spaces or line breaks
      nano /secret
    3. chmod 600 /secret
    4. chown Administrator:SYSTEM /secret
  4. Create bat file to run rsync
    1. Open Notepad and enter the following command, replacing User Name with your Windows User Name directory, username with your Ubuntu username, and ipaddress with the IP address of your Ubuntu server (e.g. 192.168.0.100):

Read Rest Of Article Here