linux rsync服務配置使用例項

2021-07-04 11:20:49 字數 1672 閱讀 2894

系統:centos 6.6

服務端ip:192.168.220.130

客戶端ip:192.168.220.129

服務端配置:

1.安裝

直接rpm包安裝,使用yum

#yum -y install rsync

2.配置

安裝完rsync後,使沒有配置檔案的,需要自己建立配置檔案和使用者認證檔案

#touch /etc/rsyncd.conf

#touch /etc/passfile

passfile檔案使用user:password的格式儲存使用者名稱和密碼,檔案中的使用者本地不用建立

passfile檔案的許可權設定為600

#echo "test:123456" > /etc/passfile

#chmod 600 /etc/passfile

自己編寫配置檔案內容,具體參考官網說明

一下是乙個例子:

#cat /etc/rsyncd.conf

uid = root

gid = root

port = 873

use chroot = yes

max connections = 10

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsync.lock

#transfer logging = yes

#log format = %t %a %u %m %o %f %b

log file = /var/log/rsyncd.log

[test]

path = /data/rsync

ignore errors

read only = true

list = false

hosts allow = 192.168.220.129

hosts deny = *

auth users = test

secrets file = /etc/passfile

3.啟動服務

/usr/bin/rsync --daemon

客戶端配置:

客戶端需要安裝rsync,不需要配置,安裝完rsync就可以使用rsync命令

需要建立密碼檔案,客戶端密碼檔案只需要密碼就可以了

#echo 123456 > /etc/passfile

#chmod 600 /etc/passfile

然後使用命令和服務端同步:

rsync -vzrptog --delete --progress [email protected]::test  /data/rsync   #將服務端中test模組中的path資料同步到本地/data/rsync中

rsync -vzrptog --delete --progress --exclude 「c/*」 [email protected]::test  /data/rsync   #除/data/rsync/c/目錄外,其他資料都同步

rsync -vzrptog --delete --progress --exclude 「c/*」 --delete-excluded [email protected]::test  /data/rsync  #除/data/rsync/c/目錄外,其他資料都同步,如果客戶端/data/rsync/c/目錄有資料也會刪除

Linux rsync伺服器的快速搭建和使用

from rsync是類unix系統下的資料映象備份工具,從軟體的命名上就可以看出來了 remote sync。它的特性如下 可以映象儲存整個目錄樹和檔案系統。可以很容易做到保持原來檔案的許可權 時間 軟硬鏈結等等。無須特殊許可權即可安裝。優化的流程,檔案傳輸效率高。可以使用rcp ssh等方式來傳...

Linux Rsync安裝配置

linux rsync3.0 實用版安裝 安裝環境 linux centos 5.3 cd usr src 下 wget 二 解壓rsync tar xzf rsync 3.0.7.tar.gz cd rsync 3.0.7 configure prefix usr local rsync make...

LINUX rsync 配置與詳解

linux rsync rsync 官方站點 url url windows 2003 rsync 服務端 rsync for windows download url 同步 伺服器端 首先安裝該服務的最新版 rsync 2.6.8.tar.gz 安裝步驟 1,tar zxvf rsync 2.6....