## rsync推送数据到服务器端 服务器端:10.188.12.126 10.188.12.127 客户端:10.188.12.14 #### 开放873端口或者停止防火墙 ###### 1、安装rsync,xinetd ``` yum -y install rsync xinetd ``` ###### 2、服务器端配置rsync及xinetd *rsync配置文件* ``` cat /etc/rsyncd.conf #全局配置 uid = root gid = root use chroot = no max connections = 100 timeout = 600 pid file = /var/run/rsyncd.pid locak file = /var/run/rsyncd.lock log file = /var/log/rsyncd.log #module [server] path = /root/test #客户端文件存放到服务器端文件的位置 read only = no #必须为no,不然会报错:@ERROR: module is read only list = yes ignore errors hosts allow = 10.188.12.14 hosts deny = * auth users = rsync secrets file = /etc/rsyncd.pass ``` *密码文件权限必须为600* ``` cat /etc/rsyncd.pass rsync:123456 ``` *xinetd配置* ``` cat /etc/xinetd.d/rsync service rsync { disable = no flags = IPv4 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID } ``` *启动rsync* ``` service xinetd restart ``` ###### 3、客户端脚本或者命令 /usr/bin/rsync -azPv --password-file=/root/pass /root/Python rsync@10.188.12.127::server/ 密码文件权限必须为600 ``` cat /root/pass 123456 ```