OB2D 架設rsync備份伺服器(方便2台電腦傳資料用)
- 設定 rsync server: (假設這台主機為163.26.174.5)
規劃建立備份目錄區(/bk)
mkdir /bk
設定: /etc/xinetd.d/rsync
vi /etc/xinetd.d/rsync
# 若要停用rsync,只要把default:off前的#拿掉即可
# default: off
# description: The rsync server is a good addition to am ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
- 設定: /etc/rsyncd.conf
vi /etc/rsyncd.conf
[mch1]
存檔
path = /bk
auth users = user
uid = root
gid = root
secrets file = /etc/rsyncd.secrets
read only = no
- 設定: 密碼檔
vi /etc/rsyncd.secrets
user:12345678
chown root.root rsyncd.secrets
chmod 600 rsyncd.secrets
service xinetd restart
- 設定 rsync client 電腦 (假設這台主機 IP 為 : 163.26.174.1)
vi /root/rsyncd.secrets
12345678
chmod 600 /root/rsyncd.secrets
- 執行
/usr/bin/rsync -rvlHpogDtS --password-file=/root/rsyncd.secrets /home user@163.26.174.5::mch1
若出現傳輸目錄檔案的畫面, 即表示測試成功.
- 安全性:(視需要設定)
vi /etc/rc.local
加入
iptables -A INPUT -p tcp -s ! 163.26.174.1 --dport 873 -j DROP
執行/etc/rc.local
留言