centos6 64X rsync 使用实战

centos  rsync 使用实战

场景: 搭建服务同步源,客户端拉取同步文件

服务端(191.168.1.100)

客户端(191.168.1.10)

客户端(191.168.1.20)


一、服务端搭建

mkdir /etc/rsync

1、创建密码文件

echo "www_app:test" > /etc/rsync/web.pas        #可以是非用户密码

2、创建配置文件

vim /etc/rsync/rsyncd.conf

编辑如下内容

# This line is required by the /etc/init.d/rsyncd script
#pid file = /var/run/rsyncd.pid 
#port = 873
#address = 192.168.1.100 #服务器ip
uid = www_app
gid = www_user


#use chroot = yes 
read only = yes


#limit access to private LANs
#hosts allow=192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0 
#hosts deny=*


max connections = 5
#motd file = /etc/rsyncd.motd
#This will give you a separate log file
log file = /home/www_op/rsync/rsync.log

#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes

log format = %t %a %m %f %b
syslog facility = local3
timeout = 300

[test]
path = /home/www_app/testdir
list=yes
ignore errors
auth users = www_app
secrets file = /etc/rsync/web.pas
comment = This is 192.168.1.100  testhome
#exclude = easylife/ samba/ 
#

[web]
path = /home/www_app/wwwroot/webhome/
list=yes
ignore errors
auth users = www_app
secrets file = /etc/rsync/web.pas
comment = This is 192.168.1.100  web home

3、启动

rsync --daemon --config=/etc/rsync/rsyncd.conf 

4、重启 

查询进程:ps -ef | grep rsync

杀掉进程:kill 进程号

启动进程:rsync --daemon --config=/etc/rsync/rsyncd.conf 


二、客户端(191.168.1.10)

1、编辑密码文件,服务端配置的密码

echo "test" > web.pas 

 rsync --list-only --password-file=web.pas www_app@192.168.1.100::test

三、常见问题

1、场景一

@ERROR: auth failed on module test

rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]

答:意思为认证失败

可能1:服务端web.pas 格式为 user:passwd,客户端web.pas 格式为:passwd

可能2:服务端 rsyncd.conf 密码文件配置错误

2、场景二

@ERROR: chroot failed

rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]

答:服务端web.pas 权限不对,必须为chmod 600 web.pas



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值