From rsync Brief Description we know that rsync is an incremental synchronization tool. Every time the rsync command is executed, data can be synchronized once, but data cannot be synchronized in real time. How to do it?
With inotify-tools, this program tool can realize one-way real-time synchronization. Since it is real-time data synchronization, the prerequisite is to log in without password authentication.
Regardless of whether it is rsync protocol or SSH protocol, both can achieve password-free authentication login.
First, generate a public key and private key pair on the client, and keep pressing Enter after typing the command. The key pair is saved in the /root/.ssh/ directory.
If you want to achieve password-free authentication login, you only need to assign a value to this variable. The value assigned is the password previously set for the virtual user li. At the same time, declare this variable as a global variable.
[root@Rocky~]# cat /etc/rsyncd_users.db
li:13579
[root@fedora~]# export RSYNC_PASSWORD=13579
Try it, success! No new files appear here, so the list of transferred files is not displayed.