[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
Installation (Possibly the system has been brought with it)
sudo apt install rsync
Create the / etc/rsyncd.conf file and add the following:
max connections = 5 log file = /var/log/rsync.log lock file = /var/lock/rsyncd.lock timeout = 300 #charset = GB18030 #Avoid Chinese scrambling in some cases [share] #Module name comment = Public Share #Paths are folder path s that need to be synchronized path = /var/test hosts allow = 192.168.0.0/16 hosts deny = * 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 username and password, password can be set arbitrarily walker:test
Modify rsyncd.secrets file permissions
sudo chmod 600 /etc/rsyncd.secrets
Start rsync
sudo systemctl start rsync
Check the port. If the port is not monitored, try restarting the system.
# 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)
Set up boot start
sudo systemctl enable rsync
[Client Testing]
System version (Windows 10 x64 1803)
winver
Client Software Version
cwRsyncServer 4.0.5.0
Synchronize server-side files locally
rsync -cvazu --progress [email protected]::share ./test #-- iconv=locale_charset,remote_charset. In some cases, Chinese scrambling can be avoided rsync -cvazu --progress --iconv=UTF-8,GB18030 [email protected]::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]
[Relevant Reading]
*** walker ***