[精选]端之间的档案传送的功能

上传人:我**** 文档编号:179895098 上传时间:2021-04-13 格式:PPTX 页数:41 大小:409.03KB
返回 下载 相关 举报
[精选]端之间的档案传送的功能_第1页
第1页 / 共41页
[精选]端之间的档案传送的功能_第2页
第2页 / 共41页
[精选]端之间的档案传送的功能_第3页
第3页 / 共41页
[精选]端之间的档案传送的功能_第4页
第4页 / 共41页
[精选]端之间的档案传送的功能_第5页
第5页 / 共41页
点击查看更多>>
资源描述

《[精选]端之间的档案传送的功能》由会员分享,可在线阅读,更多相关《[精选]端之间的档案传送的功能(41页珍藏版)》请在金锄头文库上搜索。

1、Chapter 22 簡易 FTP Server 架設 - Wu FTP,22.1 原理,File Transfer Protocol ( FTP ) 進行 Server 端與 Client 端之間的檔案傳送的功能 以 TCP 封包的模式進行 Server 與 Client 之間的連線,當連線建立之後,使用者可以在 Client 端連上 Server 端進行檔案的下載與上傳,FTP 的功能,不同等級的使用者身份,三種主要的身份 real user guest anonymous 命令記錄與登錄檔記錄 syslogd daemon 進行資料的紀錄 使用者下達過的命令與使用者傳輸資料的紀錄 限制或

2、解除使用者家目錄所在 chroot (change root,FTP 正常情況下的連線,主動模式(active) 建立指令通道 (port 21) Client request (SYN) ftp-command port : 21 Server response (SYN 與 ACK) Client ACK 建立資料傳輸通道(port 20) Client request (SYN) ftp-command port : 21 Server request (SYN) ftp-data port : 20 Client response (ACK,Active mode,client,FTP

3、 server,port 21 (ftp-command,port 20 (ftp-data,port 1024,port 1024,在 NAT 或者防火牆後端的 FTP Client 連線問題,個人PC 經過NAT主機連線 FTP Server 看到的 IP 是 NAT 主機的 FTP Server 主動由 port 20 向 NAT 主機的 1024 port 要求建立連線 (Error,Passive mode,建立指令通道 (port 21) Same as active mode 建立資料傳輸通道(port 20) Client request (SYN) ftp-command p

4、ort : 21 告訴 FTP Server 使用 PASV 模式(passive)的方式來進行資料傳輸 Server response Server 隨機選取一個大於 1024 的埠口,並經由命令通道告訴 client 端那個大於 1024 的埠口,開始等待 client 端的連線 Client request (SYN) Server response (ACK,Passive mode,client,FTP server,port 21 (ftp-command,port 20 (ftp-data,port 1024,port 1024,NAT server,22.2 套件安裝,rpm

5、-qa | grep ftp ncftp-3.0.3-6 ftp-0.17-12 wu-ftpd-2.6.1-20 wu-ftpd FTP 伺服器 ftp ftp client 端工具 ncftp 提供匿名登入的 FTP 網站的 client 端的連線 FTP 軟體,22.3 Server 端設定,1. Wu FTP 的結構 設定檔 /etc/ftpaccess /etc/ftpusers 檔案內的使用者都不能使用 FTP 的服務 /etc/ftphosts 允許或拒絕某部主機或者某位使用者是否能夠登入 FTP 主機 /etc/xinetd.d/wu-ftpd 啟動 FTP 的 daemon

6、設定檔案,Wu FTP 的結構,執行檔 ftpcount : 計算目前連線的人數 ftpwho : 顯示目前連線的使用者資訊 ftprestart : 重新啟動 ftp ftpshut : 指定時候關閉 FTP in.ftpd : Wu FTP 的 daemon 用戶端的使用執行檔 ftp ncftp,2. 最簡單的 ftpaccess 設定檔,1. 設定人物群組名稱 class classall real,guest,anonymous * class allone real,guest,anonymous *.edu.tw class alltwo guest,anonymous !* !

7、61.141.0.0/16* 2. 設定FTP管理員的e-mail位址與主機名稱 email rootlocalhost hostname vbird.adsldns.org,ftpaccess 設定檔 (Cont.,3. 允許同一次連線當中,錯誤登入的次數 loginfails 5 4. 向使用者顯示README檔案的內容訊息 readme README* login readme README* cwd=* Login : 登入 cwd=* : 變換目錄 5. 將檔案的內容直接顯示在螢幕上面 message /welcome.msglogin message .message cwd,ft

8、paccess 設定檔 (Cont.,6. 是否提供使用者線上立即執行的指令 compressyesall tar yesall chmod no guest,anonymous delete no anonymous overwrite no anonymous rename no anonymous umask no all,ftpaccess 設定檔 (Cont.,7. 將使用者執行的部分指令歷程記錄到 /var/log/xferlog log transfers anonymous,guest,real inbound,outbound,ftpaccess 設定檔 (Cont.,9.

9、匿名者的密碼驗證 no:不需要密碼確認 trivial:密碼當中必須含有 這個 e-mail 的字元 rfc822:密碼必須符合 frc822 的規範 動作 warn:使用者輸入錯誤密碼時僅顯示警告訊息,仍允許其登入 enforce:使用者輸入錯誤密碼,顯示警告訊息並中斷連線喔 passwd-check rfc822 warn deny-email IE?0User deny-email mozilla,ftpaccess 設定檔 (Cont.,10. 設定允許與不許登入 FTP 伺服器的使用者與群組 deny-uid %-99 %65534- deny-gid %-99 %65534- al

10、low-uid ftp allow-gid ftp deny-uid testing testqq deny-uid 100-1000,3. Super daemon 管理 FTP,etc/xinetd.d/wu-ftpd service ftp disable = no /etc/rc.d/init.d/xinetd restart netstat -tl ftp localhost,4.歡迎畫面,message /welcome.msglogin /welcome.msg Welcome to my FTP site. Now is the time = %T The host name

11、is %L You are %U and from %R There are %N person in my site, now. If you have any problem please call me %E,變數,T本地端主機時間 格式為 Fri Mar 21 11:28:50 2003 %C使用者目前所在的目錄 %R遠端主機的 IP 或 hostname %L本地端主機的名稱或 IP %E系統管理員的 email %U使用者的登入帳號名稱 %MFTP 主機所能允許的使用者最大連線數量 %NFTP 主機目前已經連線的使用者數量,5.限制最大線上人數,etc/ftpaccess limi

12、t all20 Any /etc/ftpmaxnumber limit guest10 Any /etc/ftpmaxnumber limit anonymous 5 Any0800-2000 /etc/ftpmaxnumber /etc/ftpmaxnumber 這裡已經太多人啦!請您等一下再進入! _,6.限制與取消使用者的家目錄,For real users /etc/ftpaccess restricted-uid * restricted-uid 200-400 test testing unrestricted-uid test testing,7.時間相關的設定項目 (/etc/

13、ftpaccess,timeout accept 120 FTP daemon等待PASV 的連線時間(client 回應) timeout connect 120 等待 client 端回應的ACK timeout data 2400 FTP 可以讓我們下載或上傳一個檔案的最多時間 timeout idle timeout maxidle 1800 多久沒有動作會被踢掉 limit-time anonymous 30 limit-time guest 100 一次連線內,多久會被強制斷線,8.流量與上傳下載的限制項目 (/etc/ftpaccess,整體檔案數目與檔案容量的限額 file-l

14、imit out 32 alltwo data-limit in 10240 alltwo 限制流量的方法 throughput /var/ftp* * 10240 -* throughput /home/test /public_html * 51200 -* throughput /home/test /realdown * oo-*.vbird.org,10. anonymous 的根目錄與建立可上傳目錄,vi /etc/ftpaccess anonymous-root /var/ftp upload upload /home/ftp/public /upload yes ftp sys

15、 0666 upload /home/ftp/public /upfiles yes ftp sys 0666 nodirs,11.針對人物的限制設定,real, guest, anonymous /etc/ftpaccess nice defumask nice 10 anonymous nice -5 real defumask 022 real defumask 002 anonymous,12.拒絕與開放某些使用者的登入,etc/ftpaccess deny 192.168.0.100 /etc/ftpdeny.msg deny *.adsldns.org /etc/ftpdeny.m

16、sg deny-uid %-499 %65000- deny-gid %-499 %65000- allow-uid ftp allow-gid ftp,使用額外檔案來抵擋:/etc/ftphosts,denytest 192.168.0.0/24 allow testing 192.168.1.0:255.255.255.0 deny test2 192.168.5.10 allow test2,14.建立 passive port,etc/ftpaccess passive ports 0.0.0.0/0 65501 65505 pasv-allow all,Example,三個群組 real, guest, anonymous real 僅允許來自 140.116.0.0/16 網域 guest, anonymous 允許來自所有網域,但不允許來自 61.141.0.0/16 網域 允許使用 passive ports port number 為 65501 - 65510 小於 499 以及大於 65000 的 UID 與 GID 都被拒絕登入,Example,最大線上人數限制

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > PPT模板库 > 其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号