BackupPC SetUp: with rsyncd on Windows XP with Cygwin

BackupPC Set-UP with rsyncd on Windows XP with Cygwin

This page is for the Windows client. "Client" is the computer being backed up by the server.
This how-to explains how to set up rsyncd with Cygwin on Windows XP.

Pre-requisites

  • Windows XP
  • Cygwin
  • IP address
  • List of folders you want backed up OR...
  • List of folders you don't want backed up
  • ~20-25 min of your time

0. Install Cygwin and Linux programs under Cygwin

Cygwin: If you have not installed Cygwin but anticipate that you will need it in the future, NOW is the time to install it!

You can download it right here. Even if you already have Cygwin, download the setup.exe file in order to install some programs to run under Cygwin.Once you start the "setup.exe" for Cygwin and follow some directions given in that setup program, you will eventually come to a section where you can select and install some Linux (Unix) programs. See the screenshot below.

As shown above, install the "rsync" program under "net".

1. Download the software package (zip)

Get it here!

Sourceforge.net (get the 'zip' package)

2. Unpackage it


Unzip the content into a temporary place (eg Desktop).

Now move the following files into C:\cygwin
  • rsyncd.conf
  • rsyncd.secrets
  • rsyncd.lock
  • Readme.txt

And move the following files into C:\cygwin\bin\.
  • rsync.exe
  • cygrunsrv.exe

If these files are already there, do not replace them.

You can discard the rest of the content of the package.

*Please note that newer versions of Cygwin-rsyncd package includes a slightly different set of files. You can simply move everything but the two "exe" files into C:\cygwin and the two "exe files into C:\cygwin\bin. (updated 12/17/08)

3. Edit Configuration Files

1.) rsyncd.secrets file

Located at C:\cygwin\rsyncd.secrets

The file should look like this:

# # The format of this file is user:password. You can have as many entries
# as you wish. These accounts are sepecifc to the rsync daemon and share
# no relation to Windows local/domain accounts, nor Cywin entries in the
# passwd file.
#
# SECURITY WARNING: Don't use these defaults of UUU for the user name
# and PPP for the password! Change them!!
#
# Also: make sure this file ends in a newline. Otherwise the last
# username/password pair will be ignored.
#
UUU:PPP


Read the instructions. As it says, make sure that the last line is a new blank line.
Replace 'UUU' with a username (no, it does not code for phenylalanine). You can just make up this username. Replace 'PPP' with a real password (should at least have numbers and alphabets).
2) C:\cygwin\rsyncd.conf File Required modification: Find the following section:

#

# Uncomment this line and change the path if # you would like to log rsync messages. # # log file = c:/rsyncd/rsyncd.log # # The location of the rsync process ID file # pid file = c:/rsyncd/rsyncd.pid # # The locations of the rsync lock file # lock file = c:/rsyncd/rsyncd.lock Change the paths to the 3 files to the following:

# log file = c:/cygwin/rsyncd.log

pid file = c:/cygwin/rsyncd.pid lock file = c:/cygwin/rsyncd.lock Then in the following section:

#

# What user(s) have access to this module. The user(s) must be # defined in the secrets file. A comma or space separated list. # # Example: # auth users = backup, root, larry # auth users = backup root larry # auth users = username, backuppc Where it says 'auth users = .....', replace any existing name(s) with the username that you placed in 'rsyncd.secrets' file AND add the user 'backuppc' (as shown in the example above). Also find the following section in the file.

#

# What hosts are allowed access to this module? By default, all # hosts are allowed access. If you wish to further strengthen # the security of your setup, uncomment and replace with the IP # address your BackupPC server. This is a flexible setting and # can be one of: # # a dotted decimal IP address: 172.16.0.17 # a address/mask in the form a.b.c.d/n: 172.16.0.0/24 # an address/mask in the form ipaddr/maskaddr: 172.16.0.0/255.255.255.0 # a hostname: backupserver # a hostname pattern using wildcards: backup* # # hosts allow = Delete the # sign from the last line and replace the IP address with the IP address for the backup server. So the last line should look like this:

hosts allow = xxx.xxx.xxx.xxx

IMPORTANT: Make the same modifications for the variables shown at the end of the file. ie for
  • hosts alow
  • auth users
Optional Modifications. By default, the backup software will back up practically everything in your 'C:\Documents and Settings' folder. If you want to specify the folders to be backed up, find the following section and modify.

#

# Exact DOS style path to the file or directory to be rsync accessible # path = c:/Documents and Settings # # A short description of the module. This is what is printed when # using rsync to 'browse' the server for what modules are available. # comment = Documents and Settings Note that the slash is forward (not backward). Also note that everything inside the specified folder will be backed up. However, you can exclude certain folders by specifying them on the config file on the server; you can let the administrator know what folders to be excluded. Moreover, you can only specify one path here (to specify multiple paths, see below). Here is an example,

path = c:/stuff/important_stuff/really_important_stuff

The 'comment' should only be 1 line. It would be a good idea to write this description for future reference Automatic Restoration - if you would like BackupPC to automatically restore files on your computer (ie the backup server has the privilege to write to your computer), then you must turn on this option (it's off by default). If you are planning on backing up system files so that you can restore the system (not just the data), this may be a good idea. Otherwise, you will have to download the desired files/folders from BackupPC and manually restore them. To turn on the option, find the following section and change 'true' to 'false'

#

# Only allow clients to READ from the server. This prevents uploads # from remote machines. If you wish to allow uploads, change this too # "true". # # WARNING: Setting this to true means that BackupPC restores via # rsyncd will fail. You most likely want to set this to "false". # read only = true

4. Change the Permission

Now we want to make the 'resyncd.secrets' file read-only. C:\cygwin\rsyncd.secrets To do this, right click the file and choose 'Properties.' Check where it says 'Read-Only'

5. Set Up rsyncd Service

Next, set up the rsync job as a service to be started at boot-up.

Click on Start --> Run

type 'cmd' and press enter. In the terminal,

cd \cygwin\bin

Then,

cygrunsrv.exe -I rsyncd -e CYGWIN=nontsec -p c:/cygwin/bin/rsync.exe -a "--config=c:/cygwin/rsyncd.conf --daemon --no-detach"

*the second command is a long one liner. You must issue these commands without any misspelling. To test to see if the above command was properly issued, Go to Control Panel --> Administrative Tools --> Services Find 'rsync' and click on 'start' to see if the service starts properly.

6. Open a Port

Finally, open a port for rsync in the firewall. Control Panel --> Firewall --> Exceptions
  • Name: rsyncd
  • Port number: 873
  • Type: TCP

7. Submit config files to Administrator

Now the final step is to create and submit configuration files to the administrator. cleintname.pl file Copy and paste the following in Notepad:

# Tell BackupPC we wish to use rsyncd: requires rsync to be running as

# a service/daemon on the client system # $Conf{XferMethod} = 'rsyncd'; # # Tell BackupPC which user name and password to use. This should # match the userName:password pair in the C:\rsyncd\rsyncd.secrets # file on the client. # $Conf{RsyncdUserName} = 'username'; $Conf{RsyncdPasswd} = 'password'; # # Tell BackupPC which share to backup. This should be the name # of the module from C:\rsyncd\rsyncd.conf on the client (the # name inside the square brackets). In the sample rsynd.conf # file the cDrive module is the entire C drive. # $Conf{RsyncShareName} = 'cDrive'; # # Link the IP address to the host name $Conf{ClientNameAlias} = 'XXX.XXX.XXX.XXX'; Now change the bolded items; username and password. For the '$Conf{RsyncShareName}' item, leave it as it is if you have not done the optional modification in the 'rsyncd.conf' file (see above). But change it to 'docs' if you have. Also change the IP address in the $Conf{ClientNameAlias} section to your IP address. Save the above file as 'clientname.pl' where 'clientname' is the name of your computer. You can find your computer name by: Control panel --> System Then send this file to the administrator and nicely ask them to place the configuration file on the server ASAP. Having Multiple Directory Paths Find the following section at the end of the 'rsyncd.conf' file, copy and paste it at the end of the file (so as to have duplicates of the entire section).

[cDrive]

path = c: comment = Entire Drive auth users = UUU secrets file = c:/cygwin/rsyncd.secrets # hosts allow = 172.16.0.17 strict modes = false read only = true list = false Then change the section name within the bracket (ie [cDrive]) for the newly created (pasted) section(s). You can change it to whatever you like, but no space please. Modify the bolded items according to the descriptions above (note that these entries are exact copies of the main section of the rsync.conf file; they just don't have the # comments sections). Now change the $Conf{RsyncShareName} = 'cDrive'; section of the 'clientname.pl' file to the following format.

$Conf{RsyncShareName} = ['cDrive', 'docs', 'name_you_made_up', 'another'];

Note that these entries are supposed to be the same as the names in [] in the rsync.conf file.

8. Connect & Back-up!

After you have heard back from the administrator, do the following to connect. Bookmark the address below and go to it; http://xxx.xxx.xxx.xxx/backuppc Now a pop-up window will ask you for the username and password. These are the ones the administrator gave you. You should see something similar to below: screenshot Click on 'Start Full Backup' button to start your first backup. Note that this first backup will take a while. The next time you back up, it will be an 'incremental' backup and should only take a few minutes. If you get any error messages, let the administrator know of that message

9. Retrieve backed-up data

To restore files / folders, simply click on 'browse backups' link on the left menu. screenshot You should see a screen like the above. Then click the checkboxes next to the files and folders you want to restore and click on 'restore selected files.' Once you click on 'restore selected files,' a screen like the below should show up. There are 3 options to what to do with the files / folders you've selected. screenshot
  • Option 1: Direct Restore
  • Option 2: Download Zip archive
  • Option 3: Download Tar archive
Option 1 will write the backed up files / folders to your harddrive (if the same file is there, it will overwrite). Option 2 and 3 will archive the files / folders and let you download the archived package as .zip or .tar respectively. This feature has other potential uses than just backup / restoration; you can access the backed up files / folders from anywhere in the world! To do a complete system restoration, follow the same direction as above for all files & folders through KNOPPIX or something equivalent. BackupPC Manual Start Page
Printer Friendly Printer Friendly

13 Responses

  1. William Says:

    Thank you for taking the time to create the directions. I followed your directions and failed to get the service, rsyncd, to run on XP. After spending several hours researching the problem and trying numerous configurations, I discovered the problem your directions to create the service apparently contains a typo. It appears to omit a “-”.

    Your instructions in step 5 reads like this:
    cygrunsrv.exe -I rsyncd -e CYGWIN=nontsec -p c:/cygwin/bin/rsync.exe -a “–config=c:/cygwin/rsyncd.conf –daemon -no-detach”

    Just before “no-detach”, you typed one “-”. This lead to the following error in the Application sections under Windows Event Viewer:
    The description for Event ID ( 0 ) in Source ( rsyncd ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: rsyncd: PID 5656: `rsyncd’ service stopped, exit status: 1.

    With only one dash, the service failed to start or would start and die within a few seconds.

    Deleting the service and recreating it with this line solved the problem.

    cygrunsrv.exe -I rsyncd -e CYGWIN=nontsec -p c:/cygwin/bin/rsync.exe -a “–config=c:/cygwin/rsyncd.conf –daemon –no-detach”

    Note this instruction includes two dashes before “no-detach”.

    Please correct your instructions.

    Again,. thanks a bunch for creating the instruction.
    –William

  2. admin Says:

    Hi William

    Thank you so much for taking the time to find/explain my typo. I imagine other people must have suffered from the same mistake of mine (I’m sorry :( ).
    I really appreciate your diligence and time. It’s people like you that makes the OSS community a better place. Thank you again.

    Tak

  3. Brian Says:

    Thanks for the great instruction set! I just have a few questions that I just cannot seem to resolve on my own/google. I am running the backuppc server on xUbuntu and attempting to setup a win vista client with cygwin. Everything seems to load correctly as I can see the user, request a backup, etc.. but the backup itself never starts it only times out. So I just don’t know if I am configuring my *.pl s incorrectly or what. Any help or assistance would be most appreciated Please email me if you get a chance @ bk352@sbcglobal.net Thanks in advance for any help you can provide!

    -Brian

  4. admin Says:

    Hi Brian,

    Could you post the error message that you get?
    Also were you able to make sure that the rsyncd service is properly started in Vista? I do not know exactly where to find that information, but I’m guessing it’s similar to XP (as in my instructions).

    Tak

  5. William Says:

    Tak:
    You’re welcome, My pleasure. Your instructions have provided me with much peace of mind. I setup a RAID1 ubuntu server that backups two XP laptops, an XP and an ubuntu desktops. Your instructions were invaluable.

    Again, thank you for doing it.

    Be joy.
    –William

  6. John Schavey Says:

    Hello,
    I have followed your instructions and keep receiving the error: auth failed on module cDrive

    Have triple checked all locations that required username/password changes and they are all accurate.

    Any help? Thanks.

  7. Tak Says:

    Hi John,

    Is this a Windows client?
    If so, do you have the administrative privilege?
    Go to Control Panel –> Administrative tasks (or something like that) –> Services and see if the rsyncd service is running. If so, I think that it has to be your config file that wasn’t modified correctly. Please post back w/ what you find.

    Tak

  8. Jomell Dangaran Says:

    Hi,

    I can’t seem to find rsyncd.lock on the zip file.

    Please help.

    Jomell

  9. Margarita Says:

    I was getting an “Access is denied” error when I tried to install rsync as service in Vista. I was able to workaround this by turning off ACL in User Accounts. I would appreciate another solution.

  10. Tak Says:

    Jomell Dangaran,

    I know it’s been a month; my bad, I’m sorry.
    You can do without the rsyncd.lock file.

    Margarita,

    “I was getting an “Access is denied” error when I tried to install rsync as service in Vista. I was able to workaround this by turning off ACL in User Accounts. I would appreciate another solution.”

    I don’t have Vista and so I’m not really sure, but can you add the service as the administrator?

  11. Davide Says:

    Hello Tak. Thank you very much for this howto. It’s very useful.

    I have a trouble when I try to restore a file, when I do it, it fails and I see on Errors log this message: Unable to read 4 bytes

    and at the end of log file I see

    Remote[1]: ERROR: module is read only
    Remote[1]: rsync error: syntax or usage error (code 1) at main.c(747) [receiver=2.6.8]

    Do you know what does it mean?
    Thank you for your patience.

    Davide

  12. nierdz Says:

    @davide it seams you don’t have set false to the read only option in rsyncd.conf.

  13. alex Says:

    Hi,

    I’m having trouble starting the rsyncd service in windows xp professional. After i click ’start’ to start the service it suddenly stop. When i try to refresh the service, it show that it is not started.

    Need help on this one. Thanks alot in advance

    Alex

Your input counts! Please make this site more interesting by leaving your comments, questions, blurb, etc. Thank you!

*
To prove you're a person (not a spam script), type the answer to the math equation shown in the picture. Click on the picture to hear an audio file of the equation.
Click to hear an audio file of the anti-spam equation

Your comment or question

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Please note: Comment moderation is enabled. However, unless you use foul language or include too many links, it should be not be put in the moderation queue.

Posted by tak, filed under Uncategorized. Date: September 8, 2007, 10:44 pm |