first, server-side configuration
1. rsyncd.conf File Description
UID = rsync #用户 to control read and write access to the module directory by the user
GID = rsync #组, used to control read and write permissions for the group Access module directory
Use chroot = no #安全相关
Max connections = #最大连接数
Timeout = #超时时间 (in seconds)
MOTD file =/etc/rsyncd/rsyncd.motd #定义登录服务器时的banner信息
PID file =/var/run/rsyncd.pid #进程对应的进程号文件
Lock file =/var/run/rsync.lock #锁文件
Log file =/var/log/rsyncd.log #错误日志目录
Ignore Errors #忽略错误
Read Only = False #可写
List = False #不能查看服务器上有哪些模块
Hosts allow = 172.16.1.0/24 10.10.80.0/24 #允许访问的网段
Hosts deny = 0.0.0.0/0 #拒绝其它访问
Auth users = rsync #远程访问用户名
Secrets file =/etc/rsync.password #远程用户访问认证密码文件
[Backup] #目录模块名
Path =/backup/#目录路径
[Test]
Path =/test/
Description:
Ignore errors option better add, otherwise a lot of crontab often error you also do not know, because you can not go to see every day each time to see log, not add this error is relatively high probability, because any big point of the project and system, disk IO is a bottleneck
2. Create a rsyncd.conf file
[[Email protected] ~] #vim/etc/rsyncd.conf
UID =Rsyncgid=Rsyncusechroot=Nomax Connections= -Timeout= -#motdfile=/etc/Rsyncd.motdpidfile=/var/run/Rsyncd.pidlockfile=/var/run/Rsync.locklogfile=/var/log/Rsyncd.logignore Errorsread only=falseList=falsehosts allow=10.47.39.0/ -hosts Deny=0.0.0.0/0Auth Users=rsyncsecretsfile=/etc/Rsync.password[backup]path=/backup/
[[email protected] ~] #vim/ETC/RSYNCD.MOTD
Welcome login rsync serser!!!!!!
[[email protected] ~]# useradd rsync-s/sbin/nologin-m
[[email protected] ~]# vim/etc/ Rsync.password
rsync:123456
[[email protected] ~]# chmod 600/etc/rsync.password
[[email Protected] ~]# Ll/etc/rsync.password
-rw-------1 root root 13 March 8 21:51/etc/rsync.password
[[Email protect Ed] ~]# rsync--daemon #启动rsync服务
[[email protected] ~]# ps-ef|grep rsync|grep-v grep
Root 31288 1 0 11:09? 00:00:00 rsync--daemon
[[email protected] ~]# mkdir/backup
[[email protected] ~]# chown-r Rsync.rsync/backup
[[email protected] ~]# ls-lid/backup
140545 drwx------2 rsync rsync 4096 February 2017/bac Kup
Second, the client configuration
[Email protected] ~]# Vim/etc/rsync.password
123456
[Email protected] ~]# chmod 600/etc/rsync.password
[Email protected] ~]# Ll/etc/rsync.password
-RW-------1 root root 13 March 8 21:51/etc/rsync.password
[Email protected] ~]# rsync-avz/root/install.log [email protected]::backup--password-file=/etc/rsync.password
Third, rsync common errors
Question one:
@ERROR: Chroot failed
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Reason:
The server-side directory does not exist or has no permissions, creating a directory and correcting permissions resolves the issue.
Question two:
@ERROR: Auth failed on module backup
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Reason:
The server side of the module (backup) needs to verify the user name password, but the client does not provide the correct user name password, authentication failed.
Provide the correct user name password to resolve this issue.
Question three:
@ERROR: Unknown module ' backup '
rsync error:error starting Client-server Protocol (code 5) at MAIN.C (1522 ) [receiver=3.0.3]
Reason:
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.
Question four:
Rsync-auzv--progress--password-file=/etc/rsync.pas [email protected]::backup/home/
Rsync:could not open password file "/etc/rsync.pas": No such file or directory (2)
Password:
@ERROR: Auth failed On module backup
rsync error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.7]
encountered this Problem: The client has not set/etc/rsync.pas this file, and when using the rsync command, this parameter is added--
Password-file=/etc/rsync.pas
Question five:
Rsync-auzv--progress--password-file=/etc/rsync.pas [email protected]::backup/home/
@ERROR: Auth failed on module backup
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.7]
Encountered this problem: the client side has set/etc/rsync.pas this file, which also set the password 111111, and the server consistent, but
Server segment settings have errors, the server should be set/etc/rsync.pas, the contents of root:111111, where the name of the login is indispensable
Question six:
Rsync-auzv--progress--password-file=/etc/rsync.pas [email protected]::backup/home/
@ERROR: ChDir failed
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.7]
This problem is encountered because the server side of the/home/backup where backup this directory is not set, so hint: ChDir failed
Question seven:
Rsync:write failed on "/home/backup2010/wensong": No space Left on device (28)
rsync error:error in file IO (code one) at RECEIVER.C (302) [receiver=3.0.7]
Rsync:connection unexpectedly closed (2721 bytes received so far) [generator]
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (601) [generator=3.0.7]
Unable to operate because of insufficient disk space.
Available space and used space can be viewed through df/home/backup2010
Issue eight: Network issues
1. Permissions issues
A hint similar to the following: Rsync:opendir "/kexue" (in Dtschannel) Failed:permission denied (13) Note to see if the directory permissions for synchronization are 755
2. Time Out
rsync:failed to connect to 203.100.192.66:connection timed out (110)
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (124) [receiver=3.0.5]
Check the server's port NETSTAT–TUNLP, remote Telnet test.
It is possible to set rules to release rsync (873 port) or to shut down the firewall directly because the firewall on the client or server is not able to communicate.
There is also a way in the synchronization process may be prompted to do not have permissions (the synchronization directory plus svcwrsync full permissions, the simpler method is to set Svcwrsync as an administrator)
3. Service not Started
rsync:failed to connect to 10.10.10.170:connection refused (111)
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (124) [receiver=3.0.5]
Start service: rsync--daemon--config=/etc/rsyncd.conf
4. Full disk space
Rsync:recv_generator:mkdir "/teacherclubbackup/rsync ..." failed:no space left on device (28)
Skipping any contents from this failed directory * * *
5, CTRL + C or a large number of files
Rsync error:received SIGINT, SIGTERM, or SIGHUP (code) at RSYNC.C (544) [receiver=3.0.5]
Rsync error:received SIGINT, SIGTERM, or SIGHUP (code) at RSYNC.C (544) [generator=3.0.5]
Description: This problem is mostly caused by the service side service is not started normally, to the server to check whether the service has started, and then see if the/var/run/rsync.pid file exists, the simplest way is to kill has started the service, Then start the service again or let the script join the System Start service level and then Shutdown-r now server
6, Xnetid start
Rsync:read error:connection Reset by Peer (104)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (759) [receiver=3.0.5]
View Rsync logs
Rsync:unable to open configuration file "/etc/rsyncd.conf": No such file or directory
Xnetid find the profile location by default is/etc, creating a soft link depending on the situation. For example:
Ln-s/etc/rsyncd/rsyncd.conf/etc/rsyncd.conf
Or, change the specified default profile path in the/etc/xinetd.d/rsync configuration file.
Rsync Configure:
Configuration one:
Ignore errors
Note: This option is best added, otherwise a lot of crontab often mistakes you do not know, because you can not see every day to see the log, not to add this error is relatively high probability, because any big point of the project and system, disk IO is a bottleneck
Rsync Error:
Error One:
@ERROR: Auth failed on module xxxxx
Rsync:connection unexpectedly closed (bytes read so far)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (150)
Note: This is because the password is set wrong, unable to log in successfully, check the RSYNC.PWD, whether the spectator suits match. This is also the case when the Rsync service is not started on the server side.
Error Two:
Password file must not being other-accessible
Continuing without password file
Password:
Description: This is because the permissions of the Rsyncd.pwd rsyncd.sec are not correct and should be set to 600. such as: chmod rsyncd.pwd
Error Three:
@ERROR: Chroot failed
Rsync:connection unexpectedly closed (bytes read so far)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (150)
Description: This is because the path path you set in rsync.conf does not exist and you want to create a new directory to enable synchronization
Error Four:
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]
Description: Firewall problem caused, this best first completely shut down the firewall, the wrong Basic Law is so, whether it is S or c, and ignore errors option problem will also cause
Error Five:
@ERROR: Access denied to www from unknown (192.168.1.123)
Rsync:connection unexpectedly closed (0 bytes received so far) [receiver]
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (359)
Description: This problem is obvious, is the configuration option host allow the problem, beginners like a permit section to make a configuration, and then the same module, resulting in
Error Six:
Rsync error:received SIGINT, SIGTERM, or SIGHUP (code) at RSYNC.C (244) [generator=2.6.9]
rsync error:received SIGUSR1 (code) at MAIN.C (1182) [receiver=2.6.9]
Description: This problem is mostly caused by the service side service is not started normally, to the server to check whether the service has started, and then see if the/var/run/rsync.pid file exists, the simplest way is to kill has started the service, Then start the service again or let the script join the System Start service level and then Shutdown-r now server
Error Seven:
Rsync:read error:connection Reset by Peer (104)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (604) [sender=2.6.9]
Description: No data exists in the original data directory
Question eight:
@ERROR: Unknown module ' backup '
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Reason:
The specified module does not exist on the server. The server address being accessed is not in hosts allow or the module name is incorrect
rsync configuration on Linux