服务端配置:shell
一、安装xinetd , 修改rsync配置vim
a. yum install xinetd服务器
b. vi /etc/xinetd.d/rsync socket
service rsync { disable = no # 将 yes 修改成 no flags = IPv6 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID }
c. /etc/init.d/xinetd start测试
d. vim /etc/rsyncd.conf ui
添加内容(注意删除注释)spa
port=873 端口号 uid = nobody 用户 gid = nobody 用户组 user chroot = no max connections = 200 timeout = 600 pid file = /var/run/rsyncd.pid lock file = /var/run/rsyncd.lock log file = /var/log/rsyncd.log [test] 模块名称 path = /www/test 对应的目录 ignore errors read only = no list = no auth users = root secrets file = /etc/rsyncd.secrets 密码文件
e. vi /etc/rsyncd.secrets 编写密码文件,而且修改文件为只读code
root:123456789
f. 建立对应目录,修改文件属主
server
mkdir /www/test
it
chown nobody.nobody -R /www/test
g. 启动服务
rsync --daemon
客户端配置:
a . 客户端默认安装了rsync,没有的话本身安装下 yum install rsync
b. 建立密码文件
vim /etc/rsyncd.passwd
123456789
c. 设置密码文件只读
chmod 600 /etc/rsyncd.passwd
运行测试:
从服务器端拉取 /usr/bin/rsync -avz --progress --password-file=/etc/rsyncd.passwd root@192.168.0.227::test /www/test 网服务器推送 /usr/bin/rsync -avz --progress --password-file=/etc/rsyncd.passwd /www/test root@192.168.0.227::test