Configuration of the rsyncd Service on a Windows Server
Using Cygwin rsync on a Windows computer to backup it remotely over ssh does not work as the Cygwin rsync process hangs. This problem has been reported frequently but was not solved yet. The only known workaround is running the rsync daemon.
This document describes configuration of the rsyncd daemon on a Windows Server with Cygwin for the purpose to backup data using Affa.
If not already done install Cygwin following these instructions
Create the /etc/rsyncd.secrets file and add the user affa with password secretword separated by a colon. Replace the placeholder secretword by a strong password. The user 'affa' does not need to exist on the local system.
Set secure permissions on /etc/rsyncd.secrets
chown 18.544 /etc/rsyncd.secrets chmod 660 /etc/rsyncd.secrets
Create the /etc/rsyncd.conf configuration file. Replace the placeholders AFFAx_IP by the ip addresses of your Affa servers (separated by blanks).
gid = 544 uid = 18 hosts allow = AFFA1_IP AFFA2_IP AFFA3_IP auth users = affa secrets file = /etc/rsyncd.secrets strict modes = true read only = true use chroot = no transfer logging = true log format = %h %o %f %l %b log file = /var/log/rsyncd.log [AFFA] path = /cygdrive comment = cygdrive root dir
Uid 18 is the userid of the System account. Gid 544 is the groupid of the Administrators group (may be shown as root/gid 0 on the Cygwin console).
Install rsyncd as a service.
cygrunsrv --install "rsyncd" --path /usr/bin/rsync --args "--daemon --no-detach" \ --desc "Starts a rsync daemon for accepting incoming rsync connections" \ --disp "Rsync Daemon" --type auto
Start the rsyncd service
net start rsyncd
Don't forget to open port 873 for the IP address of the Affa server in the Windows firewall.
Login the Affa server and run the following command, where IP_ADDRESS is the IP address of the Windows Server.
rsync -av affa@IP_ADDRESS::'AFFA/'
You should receive a file list of all your drives.
The rsync daemon protocol does not provide any encryption of the data that is transferred over the connection. Use it only in the local net or VPN.
- Login with the local Administrator account and run the Cygwin Bash Shell
- Stop services
net stop sshd net stop rsyncd
- Uninstall services
sc delete sshd sc delete rsyncd
- Remove local user sshd
net user /delete sshd
- Remove local sshd_server (Windows 2003 server only)
net user /delete sshd_server
- Close the Cygwin Bash Shell
- Remove folder c:\cygwin
Please leave your comments and suggestions on the discussion page.