cygwin-rsyncd-2.6.8_0: Rsyncd for Cygwin
========================================

PACKAGE ELEMENTS:

  - README.TXT: this file.

  - cygwin-rsyncd-2.6.8_0.zip: zip file with executables and template
    config files.

  - cygwin-rsyncd-2.6.8_0_src.tgz: sources for cygwin1.dll 1.5.21-2,
    cygrunsrv.exe 1.17-1 and rsync 2.6.8.

WHAT IS IT?

This zip file, cygwin-rsyncd-2.6.8_0.zip, contains everything you
need in order to use rsyncd (rsync running as a service) on your
Win32 system. This package was designed to be used along with
BackupPC and contains patches against the base rsync package to
improve performance when running under Cygwin.

You will need at least any  Win32 operating system that is capable
of running Cywin. Windows 2000 SP3 & XP SP1 have been tested and
confirmed to work with the package. Windows NT, or any of the 9x/ME
systems have not been tested. Windows 9x/ME do not offer services,
therefore rsync cannot be run as a service although you can manually
run rsync after boot.

WHAT IS CYGWIN?

From the Cygwin home page:

Cygwin is a UNIX environment for Windows. It consists of two parts:

  - A DLL (cygwin1.dll) which acts as a UNIX emulation layer
    providing substantial UNIX API functionality.

  - A collection of tools, ported from UNIX, which provide
    UNIX/Linux look and feel.

Cygwin essentially allows you run many UNIX/Linux applications from 
within a Win32 environment. It includes a large number of prebuilt 
UNIX applications such as Apache and Xfree86.  It's free, as in open 
source.

In order to use rsync.exe you do not have to perform a full install of
Cygwin. Everything required is packaged in this ZIP file.

The packages used to create this distribution are available from:

	Cygwin:		http://cygwin.com
	Rsync:		http://rsync.samba.org
	BackupPC:	http://backuppc.sourceforge.net
	cygwin-rsyncd:	http://sourceforge.net/projects/backuppc

The source code for the specific executables in this package are
available from http://backuppc.sourceforge.net.

WHAT IS IN THE ZIP?

rsync.exe

    The rsync executable based on rsync 2.6.8 and cygwin 1.5.21.

rsyncd.conf

    A sample configuration file that is required for rsync.exe
    to run as a service. See the comments in this file for more
    information.

rsyncd.secrets

    A sample secrets file that is for used for rsync authentication.
    The users and passwords in this file have no relation to MS
    Windows domain or local users and are only used to authenticate
    rsync clients to your computer. While the passwords are stored
    in cleartext, they are transmitted over the network random
    challenge/hash response, so no plain text password is sent over
    the network.

cygrunsrv.exe

    The Cygwin Run As Service executable based on cygwin 1.5.21-2.
    This allows you to run Cygwin applications as Windows Services.
    Version 1.17-1 is included (use cygrunsrv.exe --version to check
    the version).

cygwin1.dll

    The Cygwin Dynamic Link Library from cygwin 1.5.21-2. This
    is required for the rsync.exe and cygrunsrv.exe executables
    to function (and is the heart of the Cygwin environment).

service.bat

    A two-line batch file that installs rsyncd as a service
    using cygrunsrv and starts it.  This saves typing long
    commands by hand.  There are additional commands for
    disabling the WinXP firewall that you can run by removing
    the leading "rem".

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WARNING:
% 
% If you already have Cygwin installed then you should not
% install the cygrunsrv.exe and cygwin1.dll files. Installing
% multiple versions of the same DLL is a bad idea. Instead, you
% should manually install the rsync.exe executable in your Cygwin
% hierarchy and use the existing Cywin utilities.
%
% In fact, a package like this that contains a local cygwin1.dll
% is discouraged by the cygwin community, since if the user later
% installs the real cygwin there will be two installed cygwin1.dll's.
% Please don't complain to the cygwin user list if you do this
% and things break.
%
% Cygwin is a great package with a simple installer.  If you want
% to use Cygwin then use the setup.exe program at http://cygwin.com,
% and don't use the cygwin1.dll from this installation.  You can
% easily install rsync from the Cygwin installer.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

INSTALLING RSYNC (NO EXISTING CYGWIN)

  1. Download the latest version from SourceForge - see above.

  2. Open the file cygwin-rsyncd-2.6.8_0.zip. If you cannot open the
     ZIP file, see http://www.winzip.com.

  3. Extract the files to a directory of your choosing. It is
     recommended that you extract the files to the C:\rsyncd
     directory.  The ZIP file is flat (ie: no subdirectories).

        Archive:  cygwin-rsyncd-2.6.8_0.zip
          Length     Date   Time    Name
         --------    ----   ----    ----
            11429  08-05-06 18:39   README.TXT
            43008  06-19-06 02:43   cygrunsrv.exe
          1875110  07-23-06 17:11   cygwin1.dll
           282112  08-05-06 18:07   rsync.exe
             4415  01-17-04 19:22   rsyncd.conf
              484  05-22-04 11:20   rsyncd.secrets
              700  08-05-06 18:35   service.bat
         --------                   -------
          2217258                   7 files

  4. Edit C:\rsyncd\rsyncd.secrets by adding at least one user and 
     password pair to this file.  DO NOT USE THE DEFAULT USER:PASSWORD
     PAIR - THIS IS A SECURITY RISK!  This file must end with a
     newline.

  5. Edit C:\rsyncd\rsyncd.conf for your environment. See the comments 
     in the sample configuration file.

  6. If you did not enable "strict modes = false" in your
     modules section(s), you will need to set the permissions
     under Windows 2000 and XP on the rsyncd.secrets file so
     that they are restrictive. Mainly this means setting the
     permissions so that only the user running the service has
     read permission ONLY on the rsyncd.secrets file. If you
     fail to set the permissions correctly, connecting to the
     rsync daemon will log an error such as:

         auth failed on module temp from host.foobar.com (172.16.0.25)

     If you plan on running rsyncd as a Windows service, only the
     SYSTEM account should have read permission on the secrets file.
     Under Windows XP you may have to turn off Simple File Sharing
     (Tools->Folder Options->View) in order to see the security tab
     for setting file permissions.

  7. Either run rsync.exe manually, or run cyrunsrv.exe to install
     as a service.  To run rsync.exe manually, start a command
     prompt and type:

         cd \rsyncd
     	 rsync.exe --config=c:/rsyncd/rsyncd.conf --daemon --no-detach

     To run rsyncd as a service, so that it will automatically
     start each time the system boots (definitely the preferred
     option), start a Windowns cmd.exe command prompt and type
     the following:

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

     You can start the service either via WinXX or cygrunsrv.
     For WinXP: goto Control Panel->Administrative Tools->Services,
     scroll through the list and double-click on "rsyncd" then click
     on the Start button.  Or from the command-line you can run:

        cygrunsrv.exe --start rsyncd

     There is a batch file service.bat that includes these two cygrunsrv
     commands.  So you can just run service.bat instead from the DOS
     cmd.exe window.

     See this link for information about seeing the CYGWIN environment
     variable:

         http://www.itefix.no/phpws/index.php?module=faq&FAQ_op=view&FAQ_id=12

     If you need to change the rsyncd arguments you can either re-run
     cygrunsrv, or use WinXX regedit on
     
        HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet->Services->rsyncd->Parameters

     See cygrunsrv --help for more information.

  8. If you have Windows firewall enabled then you will need to allow
     rsync to listen on TCP port 873.  The service.bat script has
     some options commands for doing that, or you can do it through
     the WinXX firewall menus.

  9. Try copying some files from an rsync client manually. Log into
     another system that has rsync installed and try:

          rsync -av USER@SERVER::TESTDIR .

     Replace "USER" with the user you listed in the secrets file that
     has access to the module. Replace "SERVER" with the name or IP
     address of the client system running rsyncd. Replace "TESTDIR"
     with the module listed in the conf file.  If you set the "hosts
     allow" option in the conf file make sure the client you are
     running the rsync from is listed!

SETTING UP BACKUPPC TO USE WIN32 RSYNCD

The following options will have to be set in either the global
config.pl or the per-host config.pl files. For more information
see the BackupPC documentation:

    # 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}  = "UUU";
    $Conf{RsyncdPasswd}    = "PPP";

    #
    # 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";

BUGS

  1. Rsync apparently requires reverse lookups to work.

TODO

  - Add ssh support. Only a few more files will be added to the ZIP.
    This will enhance the security between the BackupPC server and
    Win32 clients running rsyncd.  However, I haven't been able to
    get ssh to work reliably with rsync on cygwin.

  - Add instructions for Win 9x/ME users: running automatically upon startup.

INTERESTED IN BUILDING RSYNC YOURSELF?

First you will need Cygwin installed, and the following packages: gcc, 
binutils, make, and patch.

To build the application for cygwin, fetch the source from
http://rsync.samba.org (also available with this distribution
on the BackupPC SourceForge site) and the cygwin-rsync-2.6.8_0.diff
patch from http://sourceforge.net/projects/backuppc.  Put them in
the same directory:

    tar zxvf rsync-2.6.8.tar.gz
    cd rsync-2.6.8
    ./configure --with-included-popt
    make
    strip rsync.exe
    make install

OTHER PRE-PACKAGED RSYNCS FOR CYGWIN

See cwRsync: http://www.itefix.no/cwrsync.  This is a prepackaged
rsync with cygwin and ssh.

LICENSE

Both rsync and Cygwin are copyrighted & distributed under version 2
of the GNU General Public License. The source for each application
contains a copy of the GNU public license. The Cygwin license
information is available at http://cygwin.com/licensing.html and
http://cygwin.com/COPYING.
