rsync for linux_第1頁
免費(fèi)預(yù)覽已結(jié)束,剩余1頁可下載查看

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、rsync for linuxrsy 服務(wù)器架設(shè)辦法 1、 yum install r 2、 創(chuàng)建以下文件: a) rootlinuxsir: /etc/rsyn 注:在/etc名目下創(chuàng)建一個(gè)rsyncd的名目,我們用來存放rsyncd.conf 和rsyncd.secrets文件; b) rootlinuxsir: /etc/rsyncd/rsyncd.conf 注:創(chuàng)建rsyncd.conf ,這是rsync服務(wù)器的配置文件; c) rootlinuxsir:touch /etc/rsyncd/rsyncd.secrets 注:創(chuàng)建rsyncd.secrets ,這是用戶密碼文件; d)

2、rootlinuxsir: 600 /etc/rsyncd/rsyncd.secrets 注:為了密碼的平安性,我們把權(quán)限設(shè)為600; e) rootlinuxsir: -lh /etc/rsyncd/rsyncd.secrets f) -rw- 1 root root 14 2007-07-15 10:21 /etc/rsyncd/rsyncd.secrets g) rootlinuxsir:touch /etc/rsyncd/rsyncd.motd 3、 下一就是我們修改 rsyncd.conf 和rsyncd.secrets 和rsyncd.motd 文件的時(shí)候了 rsyncd.conf

3、 是rsync服務(wù)器主要配置文件,我們來個(gè)容易的示例;比如我們要備份服務(wù)器上的 /home 和/opt ,在/home中,我想把beinan和samba名目排解在外; disibut under the tes of the gnu general public license v2 minimal configuration for rsync daemon see rsync(1) and rsyncd.conf(5) man pages for help this line is required by the /etc/init.d/rsyncd script p file = /va

4、r/run/rsyncd.pid port = 873 aress = 71 uid = nobody gid = nobody uid = root gid = root use chroot = yes read only = yes limit access to private lans hosts allow=/ / hosts deny=* max connections = 5 motd file = /etc/rsyncd/rsyncd.motd this will

5、give you a separate log file log file = /var/log/rsync.log this will log every file transferred - up to 85,000+ per user, per sync transfer logging = yes log format = %t %a %m %f %b syslog facility = local3 out = 300 linuxsirhome path = /home list=yes ignore errors auth users = linuxsir secrets file

6、 = /etc/rsyncd/rsyncd.secrets comment = linuxsir home clude = beinan/ samba/ beinan path = /opt list=no ignore errors comment = optdir auth users = beinan secrets file = /etc/rsyncd/rsyncd.secrets 注: 關(guān)于 auth users 是必需在服務(wù)器上存在的真切的系統(tǒng)用戶,假如你想用多個(gè)用戶,那就以,號(hào)隔開;比如 auth users = beinan , linuxsir 密碼文件:/etc/rsync

7、d/rsyncd.secrets的內(nèi)容格式:用戶名:密碼 而我們?cè)诶又衦syncd.secrets的內(nèi)容如下類似的;在文檔中說,有些系統(tǒng)不支持長密碼,自己嘗試著設(shè)置一下吧。另外 rsyncd.secrets文件權(quán)限對(duì)其它用戶組是不行讀的。假如你設(shè)置錯(cuò)了,可能rsync不工作。 linuxsir:222222 beinan:333333 注: 這里的密碼值得注重,為了平安,你不能把系統(tǒng)用戶的密碼寫在這里。比如你的系統(tǒng)用戶 linuxsir 密碼是 abcdefg ,為了平安,你可以讓rsync 中的linuxsir 為 222222 。這和samba的用戶認(rèn)證的密碼原理是差不多的; rsync

8、d.motd 文件; 它是定義rysnc 服務(wù)器信息的,也就是用戶登錄信息。比如讓用戶知道這個(gè)服務(wù)器是誰提供的等;類似服務(wù)器登錄時(shí),我們所看到的 ftp 。 固然這在全局定義變量時(shí),并不是必需的,你可以用號(hào)注掉,或刪除;我在這里寫了一個(gè) rsyncd.motd的內(nèi)容為:welcome to rsync 4、 架設(shè)rsync服務(wù)器的示例解釋: 4.1 全局定義; 在rsync 服務(wù)器中,全局定義有幾個(gè)比較關(guān)健的,按照我們前面所給的配置文件 rsyncd.conf 文件; pid file = /var/run/rsyncd.pid 注:告知進(jìn)程寫到 /var/run/r

9、syncd.pid 文件中; port = 873 注:指定運(yùn)行端口,默認(rèn)是873,您可以自己指定; address = 71 注:指定服務(wù)器ip地址; uid = nobody gid = nobdoy 注:服務(wù)器端傳輸文件時(shí),要發(fā)哪個(gè)用戶和用戶組來執(zhí)行,默認(rèn)是nobody。 假如用nobody 用戶和用戶組,可能碰到權(quán)限問題,有些文件從服務(wù)器上拉不下來。所以我就偷懶,為了便利,用了root 。不過您可以在定義要同步的名目時(shí)定義的模塊中指定用戶來解決權(quán)限的問題。 use chroot = yes 注:用chroot,在傳輸文件之前,服務(wù)器守護(hù)程序在將chroot 到文件

10、系統(tǒng)中的名目中,這樣做的益處是可能庇護(hù)系統(tǒng)被安裝漏洞侵襲的可能。缺點(diǎn)是需要超級(jí)用戶權(quán)限。另外對(duì)符號(hào)鏈接文件,將會(huì)排解在外。也就是說,你在rsync服務(wù)器上,假如有符號(hào)鏈接,你在備份服務(wù)器上運(yùn)行客戶端的同步數(shù)據(jù)時(shí),只會(huì)把符號(hào)鏈接名同步下來,并不會(huì)同步符號(hào)鏈接的內(nèi)容;這個(gè)需要自己來嘗試; read only = yes 注:read only 是只讀挑選,也就是說,不讓客戶端上傳文件到服務(wù)器上。還有一個(gè) only選項(xiàng),自己嘗試是做什么用的吧; limit access to private lans hosts allow=/ /25

11、 注:在您可以指定單個(gè)ip,也可以指定囫圇網(wǎng)段,能提高平安性。格式是ip 與ip 之間、ip和網(wǎng)段之間、網(wǎng)段和網(wǎng)段之間要用空格隔開; max connections = 5 注:客戶端最多銜接數(shù); motd file = /etc/rsyncd/rsyncd.motd 注:motd file 是定義服務(wù)器信息的,要自己寫 rsyncd.motd 文件內(nèi)容。當(dāng)用戶登錄時(shí)會(huì)看到這個(gè)信息。比如我寫的是: welcome to rsync log file = /var/log/rsync.log 注:rsync 服務(wù)器的日志; transfer logging = yes 注:

12、這是傳輸文件的日志; log format = %t %a %m %f %b syslog facility = local3 timeout = 300 4.2 模塊定義; 模塊定義什么呢?主要是定義服務(wù)器哪個(gè)名目要被同步。每個(gè)模塊都要以name形式。這個(gè)名字就是在rsync 客戶端看到的名字,其實(shí)有點(diǎn)象samba服務(wù)器提供的分享名。而服務(wù)器真正同步的數(shù)據(jù)是通過 path 來指定的。我們可以按照自己的需要,來指定多個(gè)模塊。每個(gè)模塊要指定認(rèn)證用戶,密碼文件、但排解并不是必需的; 下面前面配置文件模塊的例子: linuxsirhome 注:模塊,它為我們提供了一個(gè)鏈接的名字,鏈接到哪呢,在本模塊

13、中,鏈接到了/home名目;要用name 形式; path = /home 注:指定文件名目所在位置,這是必需指定的; auth users = linuxsir 注:認(rèn)證用戶是linuxsir ,是必需在 服務(wù)器上存在的用戶; list=yes 注:list 意思是把rsync 服務(wù)器上提供同步數(shù)據(jù)的名目在服務(wù)器上模塊是否顯示列出來。默認(rèn)是yes 。假如你不想列出來,就no ;假如是no是比較平安的,起碼別人不知道你的服務(wù)器上提供了哪些名目。你自己知道就行了; ignore errors 注:忽視io錯(cuò)誤,具體的請(qǐng)查文檔; secrets file = /etc/rsyncd/rsyncd.

14、secrets 注:密碼存在哪個(gè)文件; comment = linuxsir home data 注:注釋可以自己定義,寫什么都行,寫點(diǎn)相關(guān)的內(nèi)容就行; exclude = beinan/ samba/ 注:exclude 是排解的意思,也就是說,要把/home名目下的beinan和samba 排解在外; beinan/和samba/名目之間有空格分開 ; beinan path = /opt 注:指定文件名目所在位置; list=no comment = optdir auth users = beinan 注:是必段在服務(wù)器上存在的用戶; secrets file = /etc/rsync

15、d/rsyncd.secrets ignore errors 5、 啟動(dòng)rsync服務(wù)器 /usr/bin/rsync -daemon -config=/etc/rsyncd/rsyncd.conf 6、 列出rsync 服務(wù)器上的所提供的同步內(nèi)容 rsync -list-only : 7、 rsync 客戶端同步數(shù)據(jù) 重點(diǎn)配置文件: minimal configuration file for rsync daemon see rsync(1) and rsyncd.conf(5) man pages for help minimal configur

16、ation file for rsync daemon see rsync(1) and rsyncd.conf(5) man pages for help this line is required by the /etc/init.d/rsyncd script pid file = /var/run/rsyncd.pid port = 873 address = 4 uid = nobody gid = nobody uid = root gid = root use chroot = yes read only = yes limit access to private lans hosts allow=* hosts deny=* max connections = 5 motd file = /etc/rsyncd/rsyncd.motd this will give you a separate log file log file = /var/log/rsync.log this will log every file transferred - u

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論