rsync linux安裝和配置

#!/bin/bash
exit 0

# 服務端 ===========================================================
useradd -u 8080 -s /sbin/nologin -M web

yum install rsync -y

cp /etc/rsyncd.conf{,.bak}
vim /etc/rsyncd.conf
#
uid = web
gid = web
port = 873
fake super = yes
use chroot = no
max connections = 100
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = yes
list = false
hosts allow = 172.30.0.0/16
hosts deny = 0.0.0.0/32
auth users = teleone_backup
secrets file = /etc/rsyncd.passwd
[teleonebackup]
path = /data/backup/

echo "teleone_backup:Backup.1234" > /etc/rsyncd.passwd
chmod 600 /etc/rsyncd.passwd

mkdir /data/backup -p
chown -R web:web /data/backup/

systemctl enable rsyncd
systemctl start rsyncd

netstat -tnlp | grep 873
firewall-cmd --permanent --add-port=873/tcp
firewall-cmd --reload

# 客戶端 測試 =====================================================

yum install rsync -y

echo "Backup.1234" >  /etc/rsync.pass
chmod 600 /etc/rsync.pass

rsync -avz anaconda-ks.cfg [email protected]::teleonebackup --password-file=/etc/rsync.pass

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章