rsync 推送簡單配置

服務端配置:shell

一、安裝xinetd , 修改rsync配置vim

    a. yum install xinetd服務器

    b. vi /etc/xinetd.d/rsync socket

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 ui

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

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  編寫密碼文件,而且修改文件爲只讀code

root:123456789

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

    mkdir /www/test
it

    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
相關文章
相關標籤/搜索