[server configuration]
System version
# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic
Official documents: https://rsync.samba.org/documentation.html
install
sudo apt install rsync xinetd
Modify or add in / etc/default/rsync file
RSYNC_ENABLE=inetd
Create the / etc/xinetd.d/rsync file and add the following:
service rsync{ disable = no socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += 0 # user ID }
Create the file / etc/rsyncd.conf, and add the following:
max connections = 5 log file = /var/log/rsync.log lock file = /var/lock/rsyncd.lock timeout = 300 charset = UTF-8 #Used to avoid Chinese miscoding [share] #Module name comment = Public Share #Path is the path of the folder to be synchronized path = /var/test read only = no list = yes uid = root gid = root #'must correspond to the user name in' rsyncd.secrets' auth users = walker secrets file = /etc/rsyncd.secrets
Create the / etc/rsyncd.secrets file, and add the following:
#Configure user name and password, which can be set at will walker:test
Modify rsyncd.secrets file permissions
sudo chmod 600 /etc/rsyncd.secrets
Start / restart xinetd
sudo /etc/init.d/xinetd restart
If the port is not monitored, try restarting
# netstat -anop | grep 873 tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 929/rsync off (0.00/0/0) tcp6 0 0 :::873 :::* LISTEN 929/rsync off (0.00/0/0)
[client test]
System version (Windows 10 x64 1803)
winver
Client software version
cwRsyncServer 4.0.5.0
Synchronize server files to local
rsync -cvazu --progress walker@192.168.136.131::share ./test #-- iconv = locale﹣charset, remote﹣charset is used to avoid Chinese confusion rsync -cvazu --progress --iconv=UTF-8,GB18030 walker@192.168.136.131::share ./test
If the following error is reported, check whether the server port is open (check the firewall, restart the server...)
rsync: failed to connect to 218.107.243.2: No route to host (113) rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
[explanation of terms]
xinetd: eXtended InterNET services daemon
*** walker ***