[CentOS 4.4] 架設 rsync 伺服器

  • 安裝方式:

  • 先檢查是否有安裝rsync

  • yum list installed | grep rsync

  • rsync.x86_64 2.6.3-1 installed

  • vi /etc/xinetd.d/rsync

service rsync { disable = yes socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = –daemon log_on_failure += USERID } disable = yes 改成 disable = no 然後重新啟動xinetd /etc/init.d/xinetd restart

  • vi /etc/rsyncd.conf
  • [backup] path = /backup02 auth users = admin uid = root gid = root secrets file = /etc/rsyncd.secrets read only = no

[主機代號:自訂] path = 備份資料放置的路徑 auth users = 定義援權的帳號 uid = 應是執行時的uid gid = 應是執行時的gid secrets file = 認證密碼檔的位置 read only = 是否唯讀

  • vi /etc/rsyncd.secrets
  • 填上 admin:1234 #自己建立密碼
  • chown root:root /etc/rsyncd.secrets chmod 600 /etc/rsyncd.secrets

設定client端:

  • 自行建立rsyncd.secrets vi /etc/rsyncd.secrets

/usr/bin/rsync -a –progress –log-format=/var/log/rsync.log –delete –password-file=/etc/rsyncd.secrets /var/www/html admin@192.168.100.244::backup

  • 說明 :最後面backup名稱,就是你設定conf檔的名稱 [主機代號:自訂]
  • –progress:顯示傳送進度
  • –delete:如果傳送端沒有此檔案的話,就刪除該檔案
  • –password-file:放置密碼檔案的地方

See also