page counter next up previous contents
Next: 限制網路頻寬 Up: Rsync 檔案備援 Previous: 用法五-排除特定檔案   Contents   DYWANG_HOME

遠端同步

  1. 將 deyu1 家目錄下的 cron.daily 目錄及目錄下的檔案,用戶及群組變更為 deyu1。
    [root@kvm5 ~]# chown deyu1.deyu1 -R /home/deyu1/cron.daily
    
  2. 切換身份成 deyu1。
    [root@kvm5 ~]# su - deyu1
    Last login: Fri Oct 11 15:46:34 CST 2019 on pts/0
    
  3. 將 cron.daily 目錄同步到遠端機器 kvm7.deyu.wang (192.168.122.7) 帳號 deyu1 的家目錄,其中選項 -z 是將資料壓縮再傳送。
    [deyu1@kvm5 ~]$ rsync -avzh cron.daily deyu1@kvm7.deyu.wang:
    The authenticity of host 'kvm7.deyu.wang (192.168.122.7)' can't be established.
    ECDSA key fingerprint is 3d:18:f7:73:34:1d:c1:fb:af:70:00:fa:e0:df:2d:ca.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'kvm7.deyu.wang,192.168.122.7' (ECDSA) to the list of known hosts.
    deyu1@kvm7.deyu.wang's password: 
    sending incremental file list
    cron.daily/
    cron.daily/0yum-daily.cron
    cron.daily/logrotate
    cron.daily/man-db.cron
    
    sent 980 bytes  received 73 bytes  162.00 bytes/sec
    total size is 1.14K  speedup is 1.08
    
  4. 資料同步到 kvm7.deyu.wang 的 deyu1 家目錄了。
    [root@kvm7 ~]# ll /home/deyu1/cron.daily/
    total 6
    -rwxr-xr-x. 1 deyu1 deyu1 332 Mar 10  2015 0yum-daily.cron
    -rwx------. 1 deyu1 deyu1 191 Oct 11 16:15 logrotate
    -rwxr-xr-x. 1 deyu1 deyu1 618 Mar 18  2014 man-db.cron
    



De-Yu Wang 2020-05-14