lilinu學習筆記之ftp伺服器相關內容

才智咖 人氣:1.11W

前言:

lilinu學習筆記之ftp伺服器相關內容

半個月前開始學習REDHAT LINUX7.0。作為一個Linux新手,不可避免的遇上了一些問題,通過翻閱書籍資料,檢視BBS,自己的摸索實踐,也解決了一些問題。想到自己的經驗教訓可供他人借鑑,於是大膽寫出來,一來可以當作學習筆記儲存,二來希望對剛剛接觸Linux的朋友有所幫助。由於本人能力所限,筆記中有所疏漏不足也在所難免,還請各位高手海涵。

一、FTP簡介

在網路應用中,最廣泛的當屬WWW和FTP這兩種。FTP就是File Transport Protocol檔案傳輸協議的縮寫,FTP伺服器能夠在網路上提供檔案傳輸服務。FTP伺服器根據服務物件的.不同可分為匿名伺服器(Anonymous Ftp Server)和系統FTP伺服器。前者是任何人都可以使用,後者就只能是在FTP伺服器上有合法賬號的人才能使用。

二、ProFTPD簡介

目前在UNIX和LINUX下常用的免費FTP伺服器軟體主要是Wu-FTP和ProFTP這兩種。Wu-FTP廣泛應用在眾多的Unix和Linux系統中,是RedHat Linux預設的FTP伺服器軟體,但是被發現安全漏洞也相當多。ProFTP正是針對Wu-FTP的弱項而開發的,除了改進的安全性,還具備許多Wu-FTP沒有的特點,如設定簡單,能以Stand-alone模式執行等等。ProFTP已經成為繼Wu-FTP之後最為流行的FTP伺服器軟體,越來越多的站點選用它構築安全高效的FTP站點,TurboLinux就是一個例子。

三、ProFTP的設定

設定目標:把IP為的RedHat Linux配置為FTP伺服器,並允許以anonymous匿名訪問FTP伺服器,且只允許同一網段(10.0.8.*)的電腦對FTP的“incoming”目錄有“Write”許可權。

ProFTP的最新版本可以從ing子目錄的許可權

開啟,在和段之間新增如下設定:

Order allow,deny

Allow from 10.0.8.

Deny from all

表示在incoming這個子目錄下,從10.0.8這個網段登入的客戶端有寫入“WRITE”許可權,其它人對該目錄的寫如許可權都是被禁止的。如果要對所有的使用者開放寫入許可權,只要把和之間的內容換成“Allowall“。

四、FTP伺服器相關命令

1、ftpshut:關閉FTP服務,並在/etc下生成檔案shutmsg。要重新開放FTP服務,把/etc/shutmsg刪除。

2、ftpcout:FTP伺服器線上人數資訊顯示。

3、ftpwho:FTP伺服器線上人員名單。

附錄:全文及解釋

# This is a basic ProFTPD configuration file (rename it to

# '' for actual use. It establishes a single server

# and a single anonymous login. It assumes that you have a user/group

# "nobody" and "ftp" for normal operation and anon.

ServerName "MY REDHAT LINUX FTP" #設定FTP伺服器的名稱

ServerType standalone #設定FTP以Standalone模式執行,而不是以dameon模式

DefaultServer on #預設FTP伺服器工作

# Port 21 is the standard FTP port.

Port 21 #FTP服務預設佔用的埠

# Umask 022 is a good standard umask to prevent new dirs and files

# from being group and world writable.

Umask 022 #預設

RequireValidShell off #保證匿名使用者正常登入,不要更改

ServerIdent off #不顯示ftp伺服器版本資訊,以增強安全性

# To prevent DoS attacks, set the maximum number of child processes

# to 30. If you need to allow more than 30 concurrent connections

# at once, simply increase this value. Note that this ONLY works

# in standalone mode, in inetd mode you should use an inetd server

# that allows you to limit maximum number of processes per service

# (such as xinetd)

MaxInstances 30

# Set the user and group that the server normally runs at.

User nobody #設定FTP服務以nobody執行

Group nobody #注意:原來是“Group nobody”,一定要改為“Group nobody”

# Normally, we want files to be overwriteable.

AllowOverwrite on

# A basic anonymous configuration, no upload directories.下面一段就是匿名服務的設定。

User ftp #匿名登入使用ftp使用者

Group ftp #匿名登入使用ftp組

# We want clients to be able to login with "anonymous" as well as "ftp"

UserAlias anonymous guest #給ftp使用者anonymous的別名,使得anonymous登入就是ftp使用者登入。

# Limit the maximum number of anonymous logins

MaxClients 10 #最多10個匿名使用者同時線上

# We want '' displayed at login, and 'age' displayed

# in each newly chdired directory.

DisplayLogin #登入FTP顯示的歡迎資訊。放在FTP的根目錄下。

DisplayFirstChdir age

# Limit WRITE everywhere in the anonymous chroot

#說明看正文。

Order allow,deny

Allow from 10.0.8.

Deny from all