centos7 rsync服务器配置

1.下载rsync

yum -y install rsync

2.vi /etc/rsyncd.conf

uid = rsync
gid = rsync
port = 873
fake super = yes
use chroot = yes
max connections = 200
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
exclude = lost+found/
transfer logging = yes
log file = /var/log/rsyncd.log
log format = %t %a %m %f %b
ignore errors
list = false
hosts allow = 192.168.198.0/24
hosts deny = *

[backup]
    path = /backup
    comment = nebula userdate backup
    read only = false
    use chroot = no
    auth users = hello
    secrets file = /etc/rsync.password

uid = root
gid = root

 3.创建rsync用户

useradd -s /sbin/nologin -M rsync

4.创建数据备份储存目录,目录修改属主

mkdir /backup/

chown -R root:root /backup

5.创建认证用户密码文件

echo "hello:123" >> /etc/rsync.password

chmod 600 /etc/rsync.password

6.重启rsync服务,关闭selinux

systemctl restart rsync

setenforce 0

7.保证防火墙处于允许状态,检查873端口是否处于开放状态

firewall-cmd --state(running)

firewall-cmd --add-rich-rule='rule family=ipv4 source address=192.168.198 .0/24 port port=873 protocol=tcp accept' --permanent

客户端:

1.在客户端查看软件是否存在,不存在则下载

 rpa -qa | grep rsync

2.创建认证文件

echo "123" >> /etc/rsync.password       (只需要密码)

chmod 600 /etc/rsync.password

 3.实现数据传输

交互式

rsync -avz /etc/passwd hello@192.168.198.128::backup

免交互式

rsync -avzP /etc/hosts hello@192.168.198.128::backup --password-file=/ etc/rsync.password

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值