参考:
示例:
- 客户端命令
chmod 600 rsync.passwd
rsync -avzWun --delete --progress --password-file=/etc/rsync.passwd /mnt/data root@10.*.*.*::data
rsync -avzWun --delete --progress --password-file=/etc/rsync.passwd /mnt/data root@10.*.*.*::
0 */1 * * * rsync -avzWu --delete --progress --password-file=/etc/rsyncd.password root@10.*.*.*::jenkins /root/jenkins/ >> /etc/rsync.log 2>&1 && date >> /etc/rsync.log
- 服务端命令
rsync --daemon
- 服务端配置文件:
1、/etc/rsyncd.conf
# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
# uid = nobody
# gid = nobody
# use chroot = yes
# max connections = 4
# pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
# [ftp]
# path = /home/ftp
# comment = ftp export area
#
uid = root
gid = root
use chroot = yes
max connections = 4
pid file = /var/run/rsyncd.pid
log file = /var/log/rsync.log
port = 873
hosts allow = *
transfer logging = yes
log format = %t %a %m %f %b
timeout = 900
syslog facility = local3
[data]
path = /mnt/data
auth users = root
list=yes
secrets file = /etc/rsyncd.secrets
read only = false
[test]
path = /local/TEST
auth users = root
list=yes
secrets file = /etc/rsyncd.secrets
read only = false
2、/etc/rsyncd.password
123456
3、/etc/rsyncd.secrets
root:123346
4、文件权限
~# ls -al /etc/ |grep rsync
-rw-r--r-- 1 root root 827 Jul 13 10:48 rsyncd.conf
-rw------- 1 root root 7 Jul 13 10:49 rsyncd.password
-rw------- 1 root root 12 Jul 13 10:49 rsyncd.secrets
网友评论