Windows as a file server, using the Windows service version of rsync: Cwrsyncserver Download Address: http://rsync.samba.org
The setup process is to set the account number and password for the system service, which you can default to.
Note: This account is used to enable the Crsync Server service, you need to assign the account to the corresponding permissions to sync files, otherwise you cannot manipulate the files that are synchronized.
After the installation is complete, modify the profile rsyncd.conf and the configuration file reads as follows:
Copy Code code as follows:
Port = 52326
Use Chroot = False
Strict modes = False
#hosts Allow = * #允许所有的访问
Hosts allow = 192.168.10.2 #指定特定的IP允许访问
Log file = Rsyncd.log
Lock file = Rsyncd.lock
Max connections = 10
UID = 0
GID = 0
# Module Definitions
# Remember Cygwin naming conventions:c:\work becomes/cygwin/c/work
#
[Test]
Path =/cygdrive/c/work
Read Only = False
Transfer logging = no
[Test2]
Path =/cygdrive/d/wwwroot/yanghengfei_com
Read Only = yes
Transfer logging = no
Auth users = Coldstar #同步使用的帐号
Secrets file = Rsyncd.secrets #密码文件
Note:
The format of the Rsyncd.secrets profile is user name: password, such as:
coldstar:123456
That is, a user Coldstar was added with a password of 123456.
To perform synchronization commands on a Linux server:
RSYNC-VZRTOPG--progress--delete Rsync://coldstar@192.168.10.1:52326/test2/root/test2
Then enter the password at the password: prompt.
You can also write a password to a profile reference, such as:
RSYNC-VZRTOPG--progress--delete--password-file=/etc/rsync.pass rsync://coldstar@192.168.10.1:52326/test2/www/ Users/yanghengfei_com
The above command is written to the scheduled task, executed every 1 minutes, to achieve real-time synchronization effect.
Note:
The above command line in the-VZRTOPG V is verbose,z is compressed, R is RECURSIVE,TOPG is to maintain the original properties of the file, such as the owner, time parameters. -progress refers to the detailed progress,--delete means that if the server side deleted the file, then the client also deleted the file, to maintain true consistency.
Attached, common problems when using rsync:
Error 1:rsync:read error:connection reset by Peer (104)
Rsync Error:error in Rsync protocol The data Stream (code) at IO.C (794) [receiver=3.0.2]
Workaround: It is likely that the server side did not turn on rsync services. Open the service. or the port specified by the firewall cannot be accessed.
Error 2: @ERROR: ChDir failed
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1495) [receiver=3.0.2]
Workaround: Server-side Sync directory does not have permissions, cwrsync Default User is Svcwrsync. Add user Svcwrsync permissions for the synchronization directory.
Error 3: @ERROR: Failed to open lock file
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1495) [receiver=3.0.2]
Workaround: Add lock file = Rsyncd.lock to the server-side profile rsyncd.conf to resolve.
Error 4: @ERROR: Invalid UID Nobody
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.2]
Workaround: Add the following two lines to the rsyncd.conf file to resolve the problem
UID = 0
GID = 0
Error 5: @ERROR: Auth failed on module test2
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1296) [receiver=3.0.2]
Workaround: The server does not specify the correct secrets file, add the following configuration line in the [test2] configuration section:
Auth users = Coldstar #同步使用的帐号
Secrets file = Rsyncd.secrets #密码文件
Error 6:password file must not is other-accessible
Resolution: The client's pass file requires permission, chmod 600/etc/rsync.pass can be.