rsync 服務與配置文檔
1 某項目rsync配置文檔(關鍵字已處理)
$ cat /etc/rsyncd.conf
- #全局配置
- log file = /var/log/rsyncd.log #日誌文件
- pid file = /var/run/rsyncd.pid #pid文件
- lock file = /var/run/rsync.lock #支持max connections參數的鎖文件
- max connections = 100 #客戶端最大連接數為100
- use chroot = no #不使用chroot !!
- uid = dongnan #伺服器端傳輸文件時,要發哪個用戶和用戶組來執行;
- gid = dongnan ###默認是nobody 用戶和用戶組
- ignore errors #忽略一些無關的IO錯誤
- list = no #不允許列文件
- #address = 10.0.100.71 #監聽的ip地址與埠號
- #port = 873
- motd file = /etc/rsyncd/rsyncd.motd #定義伺服器信息,用戶登錄時會看到這個信息
- #模塊配置
- [htdocs] #模塊名稱
- path = /data/htdocs/ #指定目錄
- comment = htdocs #註釋
- read only = yes #只讀
- auth users = dongnan #基於用戶認證,如果沒有這行則是匿名,多個用戶用","分隔
- secrets file = /etc/rsyncd.secrets #保存用戶密碼,格式如下 cat /etc/rsyncd.secrets
- ### dongnan:654321
- [iso]
- path = /data/iso/
- comment = iso
- read only = no #可寫
- hosts allow = 10.0.100.0/24 #基於IP地址認證,多個IP地址用空格" "分隔
2 啟動 rsync 服務
- rsync --daemon
3 rsync 協議與埠
- $ grep -iE '^rsync' /etc/services
- rsync 873/tcp # rsync
- rsync 873/udp # rsync
4 驗證 rsync 服務
- $ lsof -i :873
- COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
- rsync 24683 root 3u IPv6 1568026 TCP *:rsync (LISTEN)
- rsync 24683 root 5u IPv4 1568027 TCP *:rsync (LISTEN)
- rsync 27218 dongnan 4u IPv4 1584387 TCP 192.168.57.71:rsync->192.168.6.150:35444 (ESTABLISHED)
- $ rsync -avzP perl 192.168.57.71::data/
- rsync server for 10.0.100.0/24 or 192.168.57.0/24
- building file list ...
- 2 files to consider
- sent 82 bytes received 16 bytes 196.00 bytes/sec
- total size is 368 speedup is 3.76
參考
http://os.51cto.com/art/201006/203217.htm
http://www.centos.bz/2011/06/rsync-server-setup/
本文出自 「dongnan」 博客,請務必保留此出處http://dngood.blog.51cto.com/446195/826632
[火星人 ] rsync 服務與配置文檔已經有432次圍觀