centos7安装配置rsync
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装配置rsync相关的知识,希望对你有一定的参考价值。
一、服务端(192.168.8.81):
- 安装软件:
yum -y install rsync
- 创建需同步的目录:
mkdir -p /home/lee/rsync
- 编辑配置文件:vim /etc/rsync.conf
motd file = /etc/rsyncd.motd transfer logging = yes log file = /var/log/rsyncd.log port = 873 address = 192.168.8.81 uid = nobody gid = nobody use chroot = no read only = yes max connections = 10 [common] comment = rsync lee path = /home/lee/rsync/ ignore errors auth users = lee secrets file = /etc/rsyncd.secrets hosts allow = 192.168.8.0/255.255.255.0 hosts deny = * list = false
- 创建用户密码:
echo "lee:123456" > /etc/rsyncd.secrets chmod 600 /etc/rsyncd.secrets
- 创建提示信息文件:
echo "rsync lee" > /etc/rsyncd.motd
- 配置防火墙规则:
iptables -I INPUT -p tcp --dport 873 -j ACCEPT
- 启动服务:
rsync --deamon echo "rsync --deamon" >> /etc/rc.local
二、客户端(192.168.8.81):
- 安装软件:
yum -y install rsync
- 创建密码文件(免输入密码):
echo "123456" > /root/passwd chmod 600 /root/passwd
- 同步:
rsync -avz --password-file=/root/passwd [email protected]::common /home/lee/rsync/
以上是关于centos7安装配置rsync的主要内容,如果未能解决你的问题,请参考以下文章