centos7安裝配置rsync
阿新 • • 發佈:2018-02-06
提示信息 add allow mark onf 安裝配置 uid secret 信息 一、服務端(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