2012-11-26

Linux使用rsync同步資料

主機端:
[root@localhost]# vi /etc/rsyncd.conf
[mail]
path = /var/spool/mail
auth users =root
uid =root
gid =root
secrets file = /etc/rsyncd.secrets
read only = yes

[home]
path = /home

auth users = root  #代表授權的帳號(設在rsyncd.secrets的帳號)
uid = root  #以uid root來啟動rsync server
gid = root  #以gid wheel來啟動rsync server
secrets file = /etc/rsyncd.secrets
read only = yes


[root@localhost etc]# vi rsyncd.secrets
root:password

備份server端:

[root@backupserver]# vi /etc/rsyncd.secrets
password

[root@backupserver]# chmod 600 /etc/rsyncd.secrets
[root@backupserver]# crontab -e
30 6 * * * /usr/bin/rsync -avrHS --password-file=/etc/rsyncd.secrets root@192.168.X.X::mail /var/spool/mail
30 7 * * * /usr/bin/rsync -avrHS --password-file=/etc/rsyncd.secrets root@192.168.X.X::home /home

【參考資料】
http://contest.ks.edu.tw/syshtml/freebsd-rsync.html

沒有留言:

張貼留言