1. 程式人生 > >centos7安裝配置rsync

centos7安裝配置rsync

提示信息 add allow mark onf 安裝配置 uid secret 信息

一、服務端(192.168.8.81):

  1. 安裝軟件:
    yum  -y  install  rsync
  2. 創建需同步的目錄:
    mkdir  -p  /home/lee/rsync
  3. 編輯配置文件:vim /etc/rsync.conf
    motd file = /etc/rsyncd.motd
    transfer logging = yes
    log file = /var/log/rsyncd.log
    port = 873
    address = 192.168.8.81
    uid = nobody
    gid = nobody
    use chroot = no
    read only = yes
    max connections = 10
    [common]
    comment = rsync lee
    path = /home/lee/rsync/
    ignore errors
    auth users = lee
    secrets file = /etc/rsyncd.secrets
    hosts allow = 192.168.8.0/255.255.255.0
    hosts deny = *
    list = false
  4. 創建用戶密碼:
    echo  "lee:123456"  >  /etc/rsyncd.secrets
    chmod  600  /etc/rsyncd.secrets
  5. 創建提示信息文件:
    echo  "rsync  lee"  >  /etc/rsyncd.motd
  6. 配置防火墻規則:
    iptables  -I  INPUT  -p  tcp  --dport  873  -j  ACCEPT
  7. 啟動服務:
    rsync  --deamon
    echo  "rsync  --deamon"  >>  /etc/rc.local

    二、客戶端(192.168.8.81):

  8. 安裝軟件:
    yum  -y  install  rsync
  9. 創建密碼文件(免輸入密碼):
    echo  "123456"  >  /root/passwd
    chmod  600  /root/passwd
  10. 同步:
    rsync  -avz  --password-file=/root/passwd  [email protected]::common  /home/lee/rsync/

    技術分享圖片

centos7安裝配置rsync