Installing and configuring Rsync (Cwrsync) under Windows

Source: Internet
Author: User
Tags file copy file size ftp symlink syslog system log connection reset file permissions


The first step is to install the service side first:



After downloading the integration package provided by CC, there is a server installation program and a green client



Let's first double-click Cwrsyncserver_4.1.0_installer.exe to install



At this point, he will prompt you to create a new system account for syncing with rsync, and you can also customize your username and password.



When the installation is complete, rsync loads as a service to run.



In the Windows service we can see a rsyncserver service, after installation he is stopped by default you can start manually, it is best to set the startup type to automatic so the next time if the server restarts this software will automatically start.



Let's take a look at how to configure the server files. In your installation directory you can find a rsyncd.conf configuration file, which is the same as Linux below, you can also find a link to this file in the Start menu



Let's start by configuring:



Use Chroot = False



Strict modes = False



Lock file = Rsyncd.lock



Hosts allow = 192.168.1.21



Max connections = 5port = 28950



GID = 0



UID = 0



Log file =/cygdrive/f/rsynclog/rsyncd.log# Module definitions



# Remember Cygwin naming conventions:c:work becomes/cygdrive/c/work



[Cr173com]



Path =/cygdrive/d/cr173/



Secrets file =/cygdrive/e/setting/rsync/rsync_db.ps



Read Only = no



List = no



Transfer logging = yes



The above configuration allows only 192.168.1.21 access, which is modified as needed. If you need to add multiple IPs to a single IP address, for example: 192.167.1.1 the entire network segment, for example: 192.168.1.0/24, or it can be 192.168.1.0/255.255.255.0



multiple IP or network segments need to be separated by a space, and "*" means all, and the default is to allow all hosts to connect.



Strict modes = False does not verify the user password,



PID = 0,uid = 0 Specifies anonymous access.



Auth users refers to the user name that accesses Data_backup



Secrets the password file that corresponds to the file data_backup user name.



Path: Specifies the file directory to synchronize



Use chroot: If "Use Chroot" is specified as true, then rsync first chroot to the directory specified by the path parameter before transferring the file. The reason for this is to implement additional security protections, but the disadvantage is that you need to roots permissions, and you cannot back up the directory files that point to external symbolic connections. By default, the Chroot value is true.



Numeric IDs



Munge symlinks



CharSet



Max connections: Specifies the maximum number of concurrent connections for the module to protect the server, and exceeding the limit of connection requests will be told to retry later. The default value is 0, which means there is no limit.



Log file: Specify the logfile for rsync



Syslog Facility: Whether to use the System Log tool. You can have the following options:



Auth, Authpriv, cron, Daemon, FTP, Kern, LPR, mail, news, security, syslog, user, UUCP, local0, Local1, Local2, Local3, lo Cal4, LOCAL5, Local6 and LOCAL7. The default is daemon.



Max verbosity



Lock file: Specifies the lock files that support the max connections parameter



Read Only: This option sets whether the client is allowed to upload files. If True then any upload requests will fail, if False and the server directory read and write permissions allow the upload to be allowed. The default value is true.



Write only: This option sets whether customers are allowed to download files. If True then any download requests will fail, if False and the server directory read and Write permissions allow the download to be allowed. The default value is true.



List: This option sets whether the module should be listed when the list of modules that the customer requests can be used. If you set this option to False, you can create a hidden module. The default value is true.



UID: Specifies the account number that transmits the data, only for the specified module. The default is:-2, which is the nobody account number.



GID: Specifies the account group that transmits the data, only for the specified module. The default is:-2, which is the nobody group.



Fake super



Filter



Exclude: Used to specify multiple files or directories separated by spaces (relative paths) and add them to the exclude list. This is equivalent to using--exclude in the client command to specify the pattern, and a module can specify only one exclude option. However, it is important to note that this option has a certain security issue and that the customer is likely to bypass the exclude list, which is best combined with the UID/GID option if you want to ensure that a particular file cannot be accessed.



Include: Used to specify that files or directories that meet the requirements are not excluded. This equates to the use of--include in client commands to specify patterns, with include and exclude to define complex exclude/include rules.



Exclude from: Specifies a file name that contains the definition of the exclude schema from which the server reads the Exclude list definition.



Include from: Specifies a file name that contains the definition of the include pattern from which the server reads the Include list definition.



Incoming chmod:



Outgoing chmod



Auth Users: Sets the authorized user name of the connection specified module.



Secrets File: Password Authentication files in the format: Username:password



Strict modes: This option specifies whether to monitor password file permissions, and if the option value is true then the password file can only be accessed by a user running the rsync server, and no other user can access the file. The default value is true.



Hosts allow: This option specifies which IP clients are allowed to connect to the module. The customer pattern definition can be in the following form:



A single IP address, for example: 192.167.1.1



The entire network segment, for example: 192.168.1.0/24, can also be 192.168.1.0/255.255.255.0



multiple IP or network segments need to be separated by a space, and "*" means all, and the default is to allow all hosts to connect.



Hosts deny: Specifies that machines that are not allowed to connect to the Rsync server can be defined using the definition of hosts allow. The default is no hosts deny definition.



Ignore errors: Specifies that RSYNCD ignores IO errors on the server when deciding whether to run the transfer or not, in general, Rsync skips the--delete operation when an IO error occurs to prevent serious problems due to temporary resource shortages or other IO errors.



Ignore nonreadable: Specifies that the RYSNC server completely ignores files that the user does not have access to. This is useful for situations where some files in a directory that need to be backed up should not be available to the backup person.



Transfer logging: Make the Rsync server use FTP-formatted files to record download and upload operations in its own separate log.



Log format: This option allows the user to customize the fields of the log file by using transfer logging.



#The Single-character escapes that is understood is as follows:



#%a the remote IP address



#%b the number of bytes actually transferred



#%b the permission bits of the file (e.g. RWXRWXRWT)



#%c The total size of the block checksums received for the basis file (if only sending)



#%f the filename (long form on sender; no trailing "/")



#%g the GID of the file (decimal) or "DEFAULT"



#%h the remote host name



#%i an itemized list of what's being updated



#%l the length of the file in bytes



#%l the string "-SYMLINK", "= = Hardlink", or "" (where SYMLINK or hardlink is a filename)



#%m the module name



#%m the last-modified time of the file



#%n the filename (short form; trailing "/" on Dir)



#%o the operation, which is "send", "recv", or "Del." (the latter includes the trailing period)



#%p the process ID of this rsync session



#%p the module path



#%t the current date time



#%u the authenticated username or an empty string



#%u the UID of the file (decimal)



#For a list of what the characters mean is output by "%i" and see the--itemize-changes option in the Rsync manpage.



Timeout: This option overrides the client-specified IP time-out. This option ensures that the rsync server does not wait forever for a crashed client. The timeout unit is seconds, and 0 means there is no timeout definition, which is also the default value. An ideal number for an anonymous rsync server is 600.



Refuse options: This option allows you to define a list of command parameters that are not allowed to be used by customers with this module. The full name of the command must be used here, not the abbreviation. However, when a command is rejected, the server reports an error message and then exits. If you want to prevent the use of compression, it should be: "Dont compress = *".



Dont compress: Specifies those files that are not compressed and then transferred, the default value is *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz



The above is the official rsync for all configuration options in the Rsync configuration file. Chinese is my own interpretation of the translation, some options have not been translated, mainly because they have not fully understood the official English interpretation.



Root:root



admin:12345



User name: password, one line, some system does not support long password, another password file permissions on other user groups is unreadable, set wrong may not work. Under Windows, password file access must be set correctly, or user authentication will not pass. The permissions of the password file e:settingrsyncrsync_db.ps should be added to the Read permission of the user name cwrsyncserver the RSYCN service running the service and set to the file as the owner.



4. In Service Manager, locate the service Rsyncserver service and start the service.



5. If the firewall is turned on, the firewall R rule to add TCP port 28950 allows communication.



6. Service verification, open the DOS command box, enter Telnet 192.168.1.20 28950 (if the Telnet server is not installed with the client, add Remove Programs in Control Panel, Open the Turn off Windows feature to find the Telnet client and server, tick install). If Telnet can connect successfully, and similar words such as @rsyncd:30.0 appear, the service starts normally.



1. Install the Rsync client program until the installation is complete. The green version is provided by CC;



2. Test the connectivity of the server rsync. The corresponding address and port at which the Rsync client resides on the computer telnet to the rsync server



Telnet 192.168.1.20 28950



A similar text such as @rsyncd:30.0 appears, indicating that the client connection server is functioning correctly.



3. Open the DOS command window and go to the bin directory of the Rsync client installation directory, such as: C:Program Filescwrsyncbin. Enter the following command to start the synchronization:



rsync--port=28950-vzrtopg--progress--delete 192.168.1.20::d ata_backup/cygwin/f/databackup--password-file=/ Cygdrive/e/setting/rsync/rsync_db.ps



--port=28950 # port-VZRTOPG--progress # Show synchronization process details--delete # Remove different data from the client directory from the server-side directory to ensure that the data on both sides is exactly the same/cygwin/f/databackup # Window under directory f:databackupdata_backup # module name defined in server configuration file rsyncd.conf file 192.168.1.20 # rsync server IP Address



The user who sets the command file needs to add the Read permission to the password file and append it to the file owner. As follows:



The official English explanation:



-V,--verbose verbose mode output



-Q,--quiet thin output mode



-C,--checksum turn on the check switch to force verification of file transfers



-A,--archive archive mode, which means to transfer files recursively and keep all file attributes equal to-rlptgod



-R,--recursive subdirectories in recursive mode



-R,--relative using relative path information



-B,--backup creates a backup, that is, the old file is renamed to ~filename when the same file name exists for the purpose. You can use the--suffix option to specify a different backup file prefix.



--backup-dir store backup files (such as ~filename) in the directory.



-suffix=suffix Defining backup File prefixes



-U,--update only updates, which is to skip all the files that already exist in DST, and the file time is later than the file to be backed up. (Does not overwrite the updated file)



-L,--links reserved Soft link



-L,--copy-links to handle soft links like regular files



--copy-unsafe-links only copies links to links outside the SRC Path directory tree



--safe-links ignoring links to the SRC Path directory tree



-H,--hard-links reserved hard link-p,--perms keep file permissions



-O,--owner hold the file belongs to the main information-G,--group keep the file group information



-D,--devices keep device file information-T,--times keep file time information



-S,--sparse special processing of sparse files to save DST space



-N,--dry-run reality which files will be transmitted



-W,--whole-file copy files without incremental detection



-X,--one-file-system do not cross file system boundaries



-B, the block size used by the--block-size=size test algorithm, is 700 bytes by default



-E,--rsh=command specifies data synchronization using RSH and SSH



--rsync-path=path Specify the path information for the rsync command on the remote server



-C,--cvs-exclude uses the same method as CVs to automatically ignore files to exclude files that you do not want to transfer



--existing only updates those files that already exist in DST without backing up those newly created files



--delete Delete those files that are not in the DST SRC



--delete-excluded also deletes those files that are excluded by the option specified by the Receive side



--delete-after transfer ends after removal



--ignore-errors Delete even if an IO error occurs



--max-delete=num deleting NUM files up to a maximum



--partial retains files that are not fully transmitted for any reason, to expedite subsequent transmissions



--force forcibly delete a directory, even if it is not empty



--numeric-ids does not match the user and group ID of a number to a user name and group name



--timeout=time IP time-out, in seconds



-I,--ignore-times do not skip files that have the same time and length



--size-only when deciding whether to back up a file, just look at the file size regardless of file time



--modify-window=num determines whether the file is time-stamped with the time Stamp window, which defaults to 0



-t--temp-dir=dir creating temporary files in Dir



--compare-dest=dir also compares the files in DIR to determine if a backup is required



-p equivalent to--partial



--progress Show Backup process



-Z,--compress compress the backed-up files during transmission



--exclude=pattern specify to exclude file modes that do not need to be transferred



--include=pattern specifies file modes that need to be transferred without exclusion



--exclude-from=file exclude files in the specified schema in file



--include-from=file does not exclude files that specify pattern matching



--version Print version Information



--address binding to a specific address



--config=file specify a different configuration file, do not use the default rsyncd.conf file



--port=port Specify a different rsync service port



--blocking-io using blocking IO for remote shells



-stats gives the transfer status of some files



--progress in the transmission of the real-time transmission process



--log-format=format specifying the log file format



--password-file=file get the password from file



--bwlimit=kbps limit I/O bandwidth, Kbytes per second-h,--help display Help information



New command execution file C:Program filescwrsyncbinsyncdb_noauth.cmd. Save the following command to the file:



rsync--port=28950-vzrtopg--progress--delete 192.168.1.20::d ata_backup/cygwin/f/databackup--password-file=/ Cygdrive/e/setting/rsync/rsync_db.ps



Windows Xp/server 2003: Start-Up settings, Control Panel, Task Scheduler, open Add Task plan, next



Windows 7/server 2008: Start, Control Panel, Administrative Tools, Task Scheduler



@ERROR: Invalid UID Nobody



Rsync Error:error Starting client-



Workaround: Add the following two lines to the rsyncd.conf file to resolve the issue



UID = 0



GID = 0



Error 1:rsync:read error:connection reset by Peer (104)



Rsync Error:error in Rsync protocol data Stream (code) at IO.C (794) [Receive r=3.0.2]



Workaround: It is possible that the Rsync service is not turned on on the server side. Turn on the service.



Error 2: @ERROR: ChDir failed



Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1495) [receiver=3.0.2]



FIX: Server-side synchronization 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 in profile rsync.conf to resolve.



Error 4:rsync:could not open password file "/cygwin/e/setting/rsync/rsync_db.pwd": No such file or directory (2)



FIX: The directory of the password file must exist and be written in POSIX style:/cygdrive/e/setting/rsync/rsync_db.pwd



Error 5: @ERROR: Auth failed on module Data_backup rsync error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.7]



FIX: Password error, enter the correct password. If the user name and password are correct, the permissions for the remote rsync server's account password file must be 600.



Error 6:password file must not being other-accessible



Workaround: This is because the permissions of the Rsyncd.pwd rsyncd.sec are not correct and should be set to 600. For example: chmod rsyncd.pwd, the owner of the password file should be changed to the user running the program under Windows.



ERROR 7: @ERROR: Invalid UID nobody. Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.7]



Workaround: Add the following two lines to the rsyncd.conf file



UID = 0



GID = 0



Issue 8: @ERROR: Chroot failed



Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]



Cause: The server-side directory does not exist or has no permissions. Creating a directory and correcting permissions can resolve the issue.



Issue 9: @ERROR: Unknown module ' tee_nonexists '



Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]



Cause: The server does not exist for the specified module. Provide the correct module name or modify the server side to the module you want to solve the problem.



Problem 10:rsync:failed to connect to 218.107.243.2:no route to host (113)



Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (104) [receiver=2.6.9]



Cause: The other side does not boot, firewall blocking, through the network has a firewall blocking, it is possible. Shutting down the firewall is actually to turn on TCP UDP 873 or the specified rsync port.



Issue 11:rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1524) [receiver=3.0.7]



Cause: There was an error in the contents of the/etc/rsyncd.conf configuration file. Please check the configuration file correctly.



Question 12:rsync:chown "" failed:invalid argument (22)



Cause: Permissions cannot be copied. Remove the parameters for the sync permission. (This is often the case when Linux is to Windows)



Question: @ERROR: Daemon Security Issue--contact admin



Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1530) [sender=3.0.6]



Cause: There is a soft connection file in the directory of the synchronization, need the server side/etc/rsyncd.conf Open Use chroot = yes. Skim the soft connection file.



Question 14:rsync:read error:connection reset by Peer (104)



Rsync Error:error in Rsync protocol data Stream (code) at IO.C (794) [receiver=3.0.2]



Workaround: It is possible that the server side does not have the Rsync service turned on and the service is turned on.


Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.