rsync配置:

app@front:/tmp/log$ cat /etc/rsyncd.conf 
use chroot = false
log file = /var/log/rsync.log

[log]
        uid = app
        gid = app
        path = /tmp/log
        comment = xxxxxx
        read only = false

client端目录:

app@front:~/test$ tree
.
├── 13223
├── a
│   ├── b
│   │   └── c
│   └── xxx
├── asdf
└── now

3 directories, 4 files	

client端执行:

app@front:~/test$ rsync -O -avz ./  rsync://x.x.x.x/log/
sending incremental file list
13223
asdf
now
a/xxx

sent 267 bytes  received 87 bytes  236.00 bytes/sec
total size is 0  speedup is 0.00

看server端,已经同步完成。

注意:

  1. chroot是到每个目录就切换到这个目录,以这个目录为根
  2. uid,gid是这个目录的所有者权限,最好是和server端目录实际的权限一致
  3. 最好设置密码