rsync同步

本地同步:

rsync -avz /boot /test

C/S架构:

远程同步:rsync+ssh

远程浏览器目录文件:rsync  用户@192.168.0.250:/boot

下行:rsync -az  root@192.168.0.250:/boot /test

上行:rsync -az /boot root@192.168.0.200:/test

用户权限控制、目录范围控制

远程同步:rsync+rsync

Client:rsync

Server:rsync --daemon

远程浏览器目录文件:rsync user@host::共享名

查看远程同步资源:rsync 192.168.0.250::

下行:rsync -az  root@192.168.0.250::共享名 /test

上行:rsync -az /boot root@192.168.0.200::共享名

搭建rsync服务端:

 yum install -y rsync

chkconfig rsync on

chkconfig xinetd on

service xinetd restart

创建rsync配置文件:vim /etc/rsyncd.conf

内容如下:

[tools] #共享名字
path = /home #共享目录
comment = test rsync #对名字的描述
auth users = ruser  #用户
secrets file = /etc/rsyncd_user.db  #允许登录的用户表

测试:

计划任务自动执行:

创建密码文件 vim /root/pwd.txt     echo "123"  >>/root/pwd.txt

设置权限:chmod 600 /root/pwd.txt     (其他用户不能有都权限)

执行命令:rsync -az ruser@192.168.0.250::tools/  /mysy  --password-file=/root/pwd.txt

原文地址:https://www.cnblogs.com/chenjw-note/p/6221890.html