centos7安装rsync及两台机器进行文件同步

安装及配置

yum -y install rsync  
#启动rsync服务
systemctl start rsyncd.service
systemctl enable rsyncd.service

#检查是否已经成功启动
netstat -lnp|grep 873

服务端配置

# /etc/rsyncd: configuration file for rsync daemon mode

# See rsyncd.conf man page for more options.

# configuration example:

uid = root
gid = root
port = 873
use chroot = no
# read only = no
# list = no
max connections = 4
# pid file = /var/run/rsyncd.pid
exclude = lost+found/
transfer logging = yes
timeout = 900
motd file = /etc/rsyncd/rsyncd.motd
log file = /var/log/rsyncd.log
lock file = /var/run/rsyncd.lock
ignore nonreadable = yes
dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

[simba]
path = /root/************/
comment=simba
ignore errors
read only = no
write only = no
list = no
auth users = root
secrets file = /etc/rsyncd.pass
hosts allow = *

给rsync定义身份,如下:

echo 'root:123456'>/etc/rsyncd.passwd   //文件用户名和路径为上面定义,别写错,密码自己定
chmod 600 /etc/rsyncd.passwd        //修改权限

 

重启服务

systemctl restart rsyncd.service

 

客户端配置

创建密码

echo '123456' >>/etc/rsyncd-test.passwd     //注意这里只需要服务器rsyncd.passwd 中的密码
chmod 600 /etc/rsyncd-test.passwd

同步

rsync -auv --password-file=/etc/rsyncd-test.passwd  /root/*********/ root@120.x.x.x::simba

 

转载于:https://www.cnblogs.com/wangbaihan/p/10734908.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值