版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、Chapter 22 簡易簡易 FTP Server 架設(shè)架設(shè) - Wu FTP 22.1 原理原理lFile Transfer Protocol ( FTP )l進(jìn)行 Server 端與 Client 端之間的檔案傳送的功能l以 TCP 封包的模式進(jìn)行 Server 與 Client 之間的連線,當(dāng)連線建立之後,使用者可以在 Client 端連上 Server 端進(jìn)行檔案的下載與上傳 FTP 的功能的功能 l不同等級的使用者身份,三種主要的身份real userguestanonymous l命令記錄與登錄檔記錄syslogd daemon 進(jìn)行資料的紀(jì)錄使用者下達(dá)過的命令與使用者傳輸資料的
2、紀(jì)錄 l限制或解除使用者家目錄所在chroot (change root) FTP 正常情況下的連線正常情況下的連線l主動模式(active)l建立指令通道 (port 21)Client request (SYN)lftp-command port : 21Server response (SYN 與 ACK) Client ACKl建立資料傳輸通道(port 20)Client request (SYN)lftp-command port : 21Server request (SYN) lftp-data port : 20 Client response (ACK)Active mod
3、eclientFTP serverport 21 (ftp-command)port 20 (ftp-data)port 1024port 1024在 NAT 或者防火牆後端的 FTP Client 連線問題 個人PC 經(jīng)過NAT主機(jī)連線FTP Server 看到的 IP 是 NAT 主機(jī)的FTP Server 主動由 port 20 向 NAT 主機(jī)的 1024 port 要求建立連線 (Error) Passive mode l建立指令通道 (port 21)Same as active model建立資料傳輸通道(port 20)Client request (SYN)lftp-comm
4、and port : 21l告訴 FTP Server 使用 PASV 模式(passive)的方式來進(jìn)行資料傳輸 Server responselServer 隨機(jī)選取一個大於 1024 的埠口,並經(jīng)由命令通道告訴 client 端那個大於 1024 的埠口,開始等待 client 端的連線 Client request (SYN)Server response (ACK)Passive modeclientFTP serverport 21 (ftp-command)port 20 (ftp-data)port 1024port 1024NAT server22.2 套件安裝套件安裝lrp
5、m -qa | grep ftp ncftp-3.0.3-6 ftp-0.17-12 wu-ftpd-2.6.1-20lwu-ftpd FTP 伺服器 lftp ftp client 端工具lncftp 提供匿名登入的 FTP 網(wǎng)站的 client 端的連線 FTP 軟體 22.3 Server 端設(shè)定端設(shè)定1. Wu FTP 的結(jié)構(gòu) 設(shè)定檔l/etc/ftpaccess l/etc/ftpusers檔案內(nèi)的使用者都不能使用 FTP 的服務(wù) l/etc/ftphosts允許或拒絕某部主機(jī)或者某位使用者是否能夠登入 FTP 主機(jī) l/etc/xinetd.d/wu-ftpd啟動 FTP 的 da
6、emon 設(shè)定檔案 Wu FTP 的結(jié)構(gòu)的結(jié)構(gòu)l執(zhí)行檔ftpcount : 計算目前連線的人數(shù) ftpwho : 顯示目前連線的使用者資訊 ftprestart : 重新啟動 ftp ftpshut : 指定時候關(guān)閉 FTP in.ftpd : Wu FTP 的 daemon l用戶端的使用執(zhí)行檔ftp ncftp 2. 最簡單的最簡單的 ftpaccess 設(shè)定檔設(shè)定檔1. 設(shè)定人物群組名稱 class class all real,guest,anonymous * class allone real,guest,anonymous *.edu.tw class alltwo guest,
7、anonymous !* !/16*2. 設(shè)定FTP管理員的e-mail位址與主機(jī)名稱 email rootlocalhost hostname ftpaccess 設(shè)定檔設(shè)定檔 (Cont.)3. 允許同一次連線當(dāng)中,錯誤登入的次數(shù) loginfails 54. 向使用者顯示README檔案的內(nèi)容訊息 readme README* login readme README* cwd=*Login : 登入cwd=* : 變換目錄5. 將檔案的內(nèi)容直接顯示在螢?zāi)簧厦鎚essage /welcome.msg login message .me
8、ssage cwd=*ftpaccess 設(shè)定檔設(shè)定檔 (Cont.)6. 是否提供使用者線上立即執(zhí)行的指令 compress yes all tar yes all chmod no guest,anonymous delete no anonymous overwrite no anonymous rename no anonymous umask no all ftpaccess 設(shè)定檔設(shè)定檔 (Cont.)7. 將使用者執(zhí)行的部分指令歷程記錄到 /var/log/xferloglog transfers anonymous,guest,real inbound,outboundftpa
9、ccess 設(shè)定檔設(shè)定檔 (Cont.)9. 匿名者的密碼驗證 lno:不需要密碼確認(rèn)ltrivial :密碼當(dāng)中必須含有 這個 e-mail 的字元lrfc822:密碼必須符合 frc822 的規(guī)範(fàn)動作lwarn:使用者輸入錯誤密碼時僅顯示警告訊息,仍允許其登入lenforce:使用者輸入錯誤密碼,顯示警告訊息並中斷連線喔 passwd-check rfc822 warndeny-email IE?0User deny-email mozillaftpaccess 設(shè)定檔設(shè)定檔 (Cont.)10. 設(shè)定允許與不許登入 FTP 伺服器的使用者與群組 deny-uid %-99 %65534-
10、 deny-gid %-99 %65534- allow-uid ftp allow-gid ftpdeny-uid testing testqq deny-uid 100-1000 3. Super daemon 管理管理 FTPl/etc/xinetd.d/wu-ftpdservice ftp disable = no l/etc/rc.d/init.d/xinetd restartlnetstat -tl lftp localhost 4.歡迎畫面歡迎畫面lmessage /welcome.msg loginl/welcome.msgWelcome to my FTP site. Now
11、 is the time = %T The host name 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 變數(shù)變數(shù) l%T本地端主機(jī)時間格式為 Fri Mar 21 11:28:50 2003l%C使用者目前所在的目錄l%R遠(yuǎn)端主機(jī)的 IP 或 hostname l%L本地端主機(jī)的名稱或 IPl%E系統(tǒng)管理員的 email l%U使用者的登入帳號名稱l%MFTP 主機(jī)所能允許的使用者最大連線數(shù)量l%NFTP 主機(jī)目前已經(jīng)連
12、線的使用者數(shù)量5.限制最大線上人數(shù)限制最大線上人數(shù) letc/ftpaccess limit all20 Any /etc/ftpmaxnumberlimit guest10 Any /etc/ftpmaxnumberlimit anonymous 5 Any0800-2000 /etc/ftpmaxnumber l/etc/ftpmaxnumber這裡已經(jīng)太多人啦!請您等一下再進(jìn)入! _ 6.限制與取消使用者的家目錄限制與取消使用者的家目錄lFor real usersl/etc/ftpaccess restricted-uid *restricted-uid 200-400 test te
13、sting unrestricted-uid test testing 7.時間相關(guān)的設(shè)定項目時間相關(guān)的設(shè)定項目 (/etc/ftpaccess)ltimeout accept 120 FTP daemon等待PASV 的連線時間(client 回應(yīng))ltimeout connect 120 等待 client 端回應(yīng)的ACK ltimeout data 2400 FTP 可以讓我們下載或上傳一個檔案的最多時間ltimeout idle timeout maxidle 1800多久沒有動作會被踢掉 llimit-time anonymous 30 limit-time guest 100一次連
14、線內(nèi),多久會被強(qiáng)制斷線 8.流量與上傳下載的限制項目流量與上傳下載的限制項目 (/etc/ftpaccess) l整體檔案數(shù)目與檔案容量的限額 file-limit out 32 alltwodata-limit in 10240 alltwol限制流量的方法 throughput /var/ftp* * 10240 -* throughput /home/test /public_html * 51200 -* throughput /home/test /realdown * oo-*. 10. anonymous 的根目錄與建立可上傳目錄的根目錄與建立可上傳目錄 lvi
15、 /etc/ftpaccessanonymous-root /var/ftpupload upload /home/ftp/public /upload yes ftp sys 0666 upload /home/ftp/public /upfiles yes ftp sys 0666 nodirs 11.針對人物的限制設(shè)定針對人物的限制設(shè)定 lreal, guest, anonymousl/etc/ftpaccess nice defumask nice 10 anonymous nice -5 real defumask 022 real defumask 002 anonymous 12
16、.拒絕與開放某些使用者的登入拒絕與開放某些使用者的登入 l/etc/ftpaccess l deny 00 /etc/ftpdeny.msg deny *. /etc/ftpdeny.msgl deny-uid %-499 %65000- deny-gid %-499 %65000- allow-uid ftp allow-gid ftp 使用額外檔案來抵擋:/etc/ftphostsl l denytest /24 allow testing : deny test2 192.1
17、68.5.10 allow test2 *14.建立建立 passive portl/etc/ftpaccess passive ports /0 65501 65505pasv-allow all * Examplel三個群組real, guest, anonymouslreal 僅允許來自 /16 網(wǎng)域lguest, anonymous允許來自所有網(wǎng)域,但不允許來自 /16 網(wǎng)域l允許使用 passive portsport number 為 65501 - 65510l小於 499 以及大於 65000 的 UID 與 GID 都被
18、拒絕登入Examplel最大線上人數(shù)限制為 30 人guest 最多 10 人, anonymous 最多為 5 人l實體用戶 mysiteuser 被限制僅能在其家目錄當(dāng)中工作,無法離開其家目錄lanonymous登入者家目錄 : /var/ftp限制 anonymous 一次連線最久 10 分鐘最多僅能下載 20 個文件,以及 10MB 的資料量上傳僅允許上傳到 /var/ftp/upload 預(yù)設(shè)檔案擁有者為 ftp,群組是 sys1.使用者的帳號使用者的帳號 2. /etc/ftpaccess 1. 針對 Server 的設(shè)定項目l針對群組的設(shè)定項目class all real,gue
19、st,anonymous /16 class allreal real /16 class allguest guest !/16 * class allanonymous anonymous !/16 *l其他主機(jī)相關(guān)的設(shè)定項目 email hostname shutdown /etc/shutmsg loginfails 3 log transfers anonymous,guest,real inbound,outbound passwd-check rfc822 warn 針對針對 Server 的設(shè)定項目的設(shè)定項目l訊息管理 readme README* login readme README* cwd=* message /welcome.msg login message .message cwd=* l指令管理 compress yes all tar yes all chmod no gue
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年山東省醫(yī)療應(yīng)急技能競賽理論試題庫大全-下(多選、判斷、填空題)
- (新版)食品生產(chǎn)企業(yè)食品安全員理論考試題庫500題(含答案)
- 2024年中考地理專項復(fù)習(xí)綜合題專項提分(解析版)
- 團(tuán)隊多樣性與管理效果計劃
- 班級心理建設(shè)的務(wù)實方法計劃
- 會計人員的職業(yè)發(fā)展路徑計劃
- 校園文化節(jié)的社團(tuán)參與計劃
- 14.2.2 完全平分公式 八年級數(shù)學(xué)人教版上冊課時優(yōu)化訓(xùn)練(含答案)
- 可持續(xù)發(fā)展年度戰(zhàn)略計劃
- 學(xué)校美術(shù)教育品牌形象建設(shè)計劃
- 人教版 七年級上冊 音樂 第2單元 祖國頌歌-歌唱祖國 教案
- 第10課《往事依依》教學(xué)課件+2024-2025學(xué)年統(tǒng)編版語文七年級上冊
- 廣東省深圳市2023-2024學(xué)年六年級上學(xué)期語文期中考試試卷(含答案)
- (人教2024版)九年級化學(xué)新教材新教材培訓(xùn) 課件(新標(biāo)題、新框架、新內(nèi)容、新理念、新思路)
- MOOC 西方文學(xué)經(jīng)典鑒賞-北京師范大學(xué) 中國大學(xué)慕課答案
- 《燒(創(chuàng))傷的急救復(fù)蘇與麻醉管理》智慧樹知到課后章節(jié)答案2023年下中國人民解放軍總醫(yī)院第四醫(yī)學(xué)中心
- 農(nóng)村文化發(fā)展的困境及對策
- 中國銀行境外匯款申請書樣板(最新版)帶中行行標(biāo)
- 中學(xué)生政治思想品德等級考核表
- 家長委員會成立主持詞
- [QC]衛(wèi)生間裝飾一次性施工成優(yōu)范本
評論
0/150
提交評論