无需安装 直接使用自带rsync即可 需要做如下配置
一、server端(IP:192.168.77.74)
vim rsync.sh
[code]
!/bin/bash
#
创建一个同步目录
mkdir -p /ying/test
写入配置文件
cat >/etc/rsyncd.conf<<EOF
port=873
log file = /var/log/rsync.log
pid file = /var/run/rsync.pid
[ying] #定义模块名称
path = /ying/ #定义同步的路劲
use chroot = no
max connections = 4
read only = yes
list = yes
uid = root
gid = root
auth users = root
secrets file = /etc/rs.passwd #定义密码文件路劲
EOF
写好server端的用户和密码
cat >/etc/rs.passwd<<EOF
root:123456
EOF
这个文件必须600权限
chmod 600 /etc/rs.passwd
后台启动 并加载配置好的配置文件
rsync –daemon /etc/rsyncd.conf
看端口
netstat -ntl|grep 873
iptables -F
iptables -F
[/code]
#
二、client端(IP:192.168.77.75)
vim rsync.sh
[code]
!/bin/bash
只要将server密码写进去即可
cat >/etc/rs.passwd<<EOF
123456
EOF
权限
chmod 600 /etc/rs.passwd
iptables -F
iptables -F
开始使用
rsync -avz –password-file=/etc/rs.passwd root@192.168.77.74::ying/* .
[/code]