圖-ProFTPD
一. proftpd 簡介。
proftpd是一款開放源碼的ftp伺服器軟體,它是原來世界範圍使用最廣泛的wu-ftpd的改進版,它修正了wu-ftpd的許多缺陷,在許多方面進行了重大的改進,其中一個重要變化就是它學習了Apache 的配置方式,使proftpd的配置和管理更加簡單易懂。本文將介紹它在Red hat Linux 9中最基本的安裝和配置。
二.軟體的相關資源。
官方網站:http://www.proftpd.org/
源碼軟體包:proftpd是開源的軟體,可以去其官方網站下載。目前最新穩定版本為1.2.10。
協助文檔: 該軟體包中包含。
FAQ:該軟體包中包含。
設定檔範例:該軟體包中包含。
三.軟體的安裝。
1.安裝
由其官方網站中下載其源碼軟體包proftpd-1.2.10. tar.gz。接下來我將對安裝過程的一些重要步驟,給出其解釋:
[root@localhost root]#tar xzvf proftpd-1.2.10. tar.gz[root@localhost root]#cd bind-9.3.1[root@localhost bind-9.3.1]#./configure [root@localhost bind-9.3.1]#make[root@localhost bind-9.3.1]#make install
tar xzvf bind-9.3.1.tar.gz 解壓縮軟體包。
./configure 針對機器作安裝的檢查和設定,大部分的工作是由機器自動完成的,但是使用者可以通過一些參數來完成一定的設定,其常用選項有:
./configure --help 察看參數設定協助。
--enable-ipv6 支援ipv6。
可以設定的參數很多,可以通過 -help察看需要的,一般情況下,預設設定就可以了。
預設情況下,安裝過程應該建立了:
proftpd的deamon為/usr/local/sbin/proftpd
proftpd的設定檔,/usr/local/etc/proftpd.conf。
2.啟動:
[root@localhost root]# /usr/local/sbin/proftpd -c /usr/local/etc/proftpd.conf
-c選項用來指定設定檔的位置,不指定的話預設位置是 /usr/local/etc/proftpd.conf 。
正常情況下proftpd應該啟動了,ps aux 應該可以查到proftpd的進程,或netstat -an 也可以看到21連接埠的服務已經起來了。(ftp預設連接埠)
如果要設定開機自啟動ftp server,只需在/etc/rc.d/rc.local中加入一行
- /usr/local/sbin/proftpd
-
- #!/bin/sh## This script will be executed*after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/usr/local/sbin/proftpd
-
四.軟體的配置。
1.初始設定檔
預設設定檔的位置為:
/usr/local/etc/proftpd.conf (如果檔案不存在可以從壓縮包中把設定檔範例拷貝過來即可)下面逐項分析其中一些常選項:(#後面的部分是注釋)
- # This is a basic ProFTPD configuration file (rename it to # 'proftpd.conf' 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 "ServerType standaloneDefaultServer on# Port 21 is the standard FTP port.Port 21
ServerType 指定FTP Server 的啟動類型,一般使用standalone方式比較簡單,如果訪問量不大,為節省資源考慮用xinetd偵聽啟動,必須在這裡指定。Port 指定FTP的偵聽連接埠,一般使用21連接埠
- # Umask 022 is a good standard umask to prevent new dirs and files# from being group and world writable.Umask 022# To prevent DoS attacks, set themaximum 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 modeyou should use an inetd server# that allows you to limit maximumnumber of processes per service# (such as xinetd).MaxInstances 30
-
Umask 指定FTP server 進程的Umask 值,022與Linux系統得預設值一致。
MaxInstances 指定 FTP server 的最大串連數。
- # Set the user and group under which the server will run.User nobody Group nogroup # To cause every FTP user to be"jailed" (chrooted) into their home# directory, uncomment this line.#DefaultRoot ~DefaultRoot
User 和Group 指定proftpd 進程啟動時的有效使用者ID,處於安全考慮預設的身份是nobody,有一點要指出的是,一般Red Linux 9.0 中預設是沒有nogroup 這個組的,把Group指定為nobody 即可。
DefaultRoot 選項限制Linux 系統使用者通過FTP方式登入時將被限制在其home 目錄下。
- # Set the maximum number of secondsa data connection is allowed# to "stall" before being aborted.#TimeoutStalled 300AllowRetrieveRestart onAllowStoreRestart on# Normally, we want files to be overwriteable. AllowOverwrite on
TimeoutStalled 指定一個串連的逾時時間。
AllowRetriveRestart 和AllowStroeRestart 指定允許斷點續傳。
User ftp Group ftp # We want clients to be able to login with "anonymous" as well as "ftp" UserAlias anonymous ftp# Limit the maximum number of anonymous logins MaxClients 10# We want 'welcome.msg' displayed at login, and '.message' displayed # in each newly chdired directory. DisplayLogin welcome.msg DisplayFirstChdir .message# Limit WRITE everywhere in the anonymous chrootDenyAll
這一部分,將在後面詳細介紹。