Suppose there is a A, a, two computers, host a IP is: 192.168.1.12 Host B IP is: 192.168.1.13, host A has a user tt2 tail/etc/passwd as follows:
Tt2:x:500:500::/home/tt2:/bin/bash
Host B has a user: Soar tail/etc/passwd as follows:
Soar:x:500:500::/home/soar:/bin/bash
In general, the account name of the synchronization should be the same, if not the same, as follows:
To synchronize the content of B to a, first look at what you want to sync:
[[email protected] local]# LL 2
Total Dosage 4
-rw-r--r--1 soar Soar 12 November 06:40 1.txt
lrwxrwxrwx 1 soar soar 25 November 06:40 2.link/usr/local/source/2/2.txt
-rw-r--r--1 soar soar 0 November 08:12 3.txt
The synchronization commands are as follows:
Rsync-av 2/[Email protected]:/usr/local/source/1/
Switch to the/usr/local/source/1/directory of host A to view:
[[email protected] source]# LL 1/
Total Dosage 4
-rw-r--r--1 tt2 tt2 12 November 06:40 1.txt
lrwxrwxrwx 1 tt2 tt2 25 November 06:40 2.link/usr/local/source/2/2.txt
-rw-r--r--1 tt2 tt2 0 November 08:12 3.txt
You can see the files synced over them, their owners, and the owning group has changed because the UID of the source file, and the GID is 500,500
After synchronizing to the target directory, the UID and GID are 500:500 corresponding accounts become TT2
Similarly: If the owner of the source file being synchronized is root, synchronizing the target file with the SOAR account, the target file owner becomes soar after synchronization
Rsync-av--progress 1/[Email protected]:/usr/local/source/1/
In general, it should be better to synchronize with the same account
If you synchronize
rsync Sync Issues