安装xinetd , 修改rsync配置
a. yum install xinetd
b. vi /etc/xinetd.d/rsync
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
添加内容(注意删除注释)
port=873 端口号
uid = nobody 用户
gid = nobody 用户组
user chroot = no
max connections = 200
timeout = 600
pid file = /var/run/rsyncd.pidlock file = /var/run/rsyncd.locklog 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 编写密码文件,并且修改文件为只读
root:123456789
f. 创建对应目录,修改文件属主
mkdir /www/test
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
转载于:https://blog.51cto.com/lookingdream/1838673