rsync 推送簡單配置

jopen 10年前發布 | 34K 次閱讀 rsync Linux

服務端配置:

1、安裝xinetd , 修改rsync配置

    a. yum install xinetd

    b. vi /etc/xinetd.d/rsync 

service rsync
{
        disable = no  # 將 yes 修改為 no 
        flags           = IPv6
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}

    c. /etc/init.d/xinetd start

    d. vim /etc/rsyncd.conf 

     添加內容(注意刪除注釋)

port=873  端口號
uid = nobody 用戶
gid = nobody 用戶組
user chroot = no
max connections = 200
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log

[test]  模塊名稱
path = /www/test  對應的目錄
ignore errors
read only = no
list = no
auth users = root
secrets file = /etc/rsyncd.secrets 密碼文件

    e. vi /etc/rsyncd.secrets  編寫密碼文件,并且修改文件為只讀

root:123456789

     f. 創建對應目錄,修改文件屬主

    mkdir /www/test

    chown nobody.nobody -R /www/test

   g. 啟動服務

    rsync --daemon

 

客戶端配置:

a . 客戶端默認安裝了rsync,沒有的話自己安裝下 yum install rsync

b. 創建密碼文件

    vim /etc/rsyncd.passwd 

123456789

c. 設置密碼文件只讀

    chmod 600 /etc/rsyncd.passwd

 

運行測試:  

從服務器端拉取
/usr/bin/rsync -avz --progress --password-file=/etc/rsyncd.passwd root@192.168.0.227::test /www/test

網服務器推送
/usr/bin/rsync -avz --progress --password-file=/etc/rsyncd.passwd  /www/test root@192.168.0.227::test

 

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!