Proftpd的配置
Proftpd的配置:ProFTPD設(shè)計目標(biāo)是實現(xiàn)一個安全且易于設(shè)定的FTP Server。
目前Unix或類Unix平臺上 FTP Server十分有限,最常使用的恐怕就是wu-ftpd了。雖然wu-ftpd有著極佳的效能同時也是一套很好的軟件,然而它卻欠缺了許多Win32平臺上FTP Server的一些特色,同時wu-ftpd過去也有不少的安全漏洞陸續(xù)被發(fā)現(xiàn)。
ProFTPD的原創(chuàng)者本身就曾經(jīng)花非常多的時間尋找wu-ftpd 的漏洞加以改進并且增加許多功能。然而十分不幸的是,他很快地發(fā)現(xiàn)顯然wu-ftpd需要全部重新的改寫才能補足欠缺的設(shè)定能力以及缺乏的一些功能。
ProFTPD不是從其它FTP Server的既有原始碼修改而產(chǎn)生的,相反的,它是完全獨立而完整、重新改寫的FTP Server。
主要特色:
一個單一的和 Apache 的 httpd.conf 類似的配置文件
每個目錄下的 .ftpaccess 文件(和 Apache 的. htaccess 類似)
很容易配置的,多個虛擬 FTP 服務(wù)器以及匿名 FTP 服務(wù)
可以單獨運行也可以從 inetd/xinetd 啟動
匿名 FTP 的根目錄不需要特別的目錄結(jié)構(gòu)
系統(tǒng)的二進制文件和其他系統(tǒng)文件沒有 SITE EXEC 命令
在單獨運行方式下,以非特權(quán)用戶運行,降低攻擊風(fēng)險
日志以及 utmp/wtmp 支持
Shadow 口令支持
一、軟件下載
proftpd-1.3.0rc3.tar.gz
二、解壓縮、編譯安裝
# 解壓縮
- [root@localhost /]# tar zvxf proftpd-1.3.0rc3.tar.gz
- [root@localhost /]#cd proftpd-1.3.0rc3
- #編譯安裝(安裝到/usr/local/proftpd目錄下,可隨意改變此目錄)
- [root@localhost proftpd-1.3.0rc3]# ./configure --prefix=/usr/local/proftpd
- [root@localhost proftpd-1.3.0rc3]# make
- [root@localhost proftpd-1.3.0rc3]# make install
#p#
三、建立FTP用戶及相關(guān)權(quán)限(此處可根據(jù)實際需要配置)
1、建立用戶組及用戶
- [root@localhost /]# groupadd ftpusers # 增加一個ftpusers組
- [root@localhost /]# useradd -d /tools -g ftpusers -s /sbin/nologin softsoul
- # 在ftpusers組增加一個名為softsoul的用戶,目錄設(shè)定為/tools,軟件上傳專用
- [root@localhost /]# useradd -d /var/www/html -g ftpusers -s /sbin/nologin websoul # 在ftpusers組增加一個名為websoul的用戶,目錄設(shè)定為/var/www/html,WEB server專用
2、建立上傳目錄
- # 如果你已經(jīng)配置好WEB server,/var/www/html目錄已經(jīng)存在,只需如下修改目錄權(quán)限(也可以在GUI界面下操作)
- [root@localhost /]# chgrp -R ftpusers /var/www/html # 把wwwroot的歸屬組改為 ftpusers 組
- [root@localhost /]# chmod -R 775 /var/www/html # 設(shè)置權(quán)限,ftpusers組對該文件夾具有讀寫執(zhí)行的權(quán)限,其他用戶只有讀、執(zhí)行權(quán)限(不可沒有執(zhí)行權(quán)限,否則web瀏覽不了)
- [root@localhost /]# mkdir tools #在根目錄下建立tools目錄,作為軟件目錄
- [root@localhost /]# chgrp -R ftpusers tools # 把tools的歸屬組也改為 ftpusers 組
- [root@localhost /]# chmod -R 775 /tools # 設(shè)置權(quán)限
#p#
四、FTP server配置
- # 如果是和偶一樣的菜鳥,建議在GUI界面下用gedit打開/usr/local/proftpd/etc/proftpd.conf進行配置,配置之前建議做好備份
- [root@localhost /]# vi /usr/local/proftpd/etc/proftpd.conf
- # 以下是偶的proftpd.conf配置內(nèi)容
- # 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 "Soul's FTP Server"
- ServerType standalone
- DefaultServer on
- # Port 21 is the standard FTP port.
- Port 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 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 # 最多有30個proftpd的PID
- MaxHostsPerUser 1 "Sorry, you may not connect more than one time" # 每個IP只允許一個連接
- MaxClientsPerUser 1 "Only one such user at a time" # 每個帳戶在每個客戶端最多可以同時登陸1次
- MaxClientsPerHost 1 "Sorry, you may not connect more than one time" # 同一個客戶端只能最多1個帳號可以登陸
- # Set the user and group under which the server will run.
- User nobody
- Group nobody
- # To cause every FTP user to be "jailed" (chrooted) into their home
- # directory, uncomment this line.
- DefaultRoot ~ ftpuser # 限制ftpusers組的用戶在自己的目錄下
- # Normally, we want files to be overwriteable.
- AllowOverwrite on # 是否允許覆蓋
- # Bar use of SITE CHMOD by default
- DenyAll
- # 設(shè)置只有ftpusers組的用戶可以ftp登錄
- DenyALL
- AllowGroup ftpuser
- # 設(shè)置帳號websoul擁有/var/www/html目錄的所有權(quán)限
- AllowUser websoul
- # 設(shè)置帳號softsoul擁有/tools目錄的所有權(quán)限
- AllowUser softsoul
- # Limit the maximum number of anonymous logins
- MaxClients 10 # 最多允許10個用戶在線
- # We want 'welcome.msg' displayed at login, and '.message' displayed
- # in each newly chdired directory.
- DisplayLogin welcome.msg # 當(dāng)使用者登錄時,則會顯示 welcome.msg 中的歡迎詞信息
- DisplayFirstChdir .message # 當(dāng)使用者轉(zhuǎn)換目錄,則會顯示 .message 中的信息
- ##(上面的歡迎信息我測試后好象不成功,郁悶中,,,,,)
- ServerIdent off # 屏蔽服務(wù)器版本信息
- MaxLoginAttempts 3 # 最大連接次數(shù)
- WtmpLog on # 是否要把ftp記錄在日志中,如果不想可以設(shè)置成off屏蔽掉log日志。
- TimeoutIdle 600 # 客戶端idel時間設(shè)置,默認(rèn)就是600秒
- AllowRetrieveRestart on # 下載時,允許斷點續(xù)傳(默認(rèn)已有,可不設(shè)置)
- AllowStoreRestart on # 上傳時,允許斷點續(xù)傳
- # 讓proftp支持現(xiàn)在流行的FXP傳輸方式,默認(rèn)是不支持的。
- AllowForeignAddress on
- PassivePorts 49152 65534 # 端口也可自己指定喜歡的
- # 下面是關(guān)于匿名用戶的相關(guān)配置,根據(jù)需要自己設(shè)定,因為我不需要匿名用戶登錄,所以全部屏敝掉了
- # A basic anonymous configuration, no upload directories. If you do not
- # want anonymous users, simply delete this entire section.
- #
- # 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 chroot
- #
- # DenyAll
- #
- #
#p#
五、開機自動運行proftpd
- # 若需要將proftpd設(shè)置為系統(tǒng)啟動時自動啟動則通過如下命令拷貝啟動文件:
- [root@proftpd-1.3.0rc3]# cp ./contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
- # 修改該腳本的可執(zhí)行屬性:
- [root@localhost /]# chmod +x /etc/rc.d/init.d/proftpd
**********以下內(nèi)容,大家可以參考****************************
然后編輯/etc/rc.d/init.d/functions:
修改
- export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
為
- export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin"
注:若將在運行./cofigure命令時通過--prefix選項指定將proftpd安裝在/usr/sbin目錄下則不需要修改fuctions文件。
***************************************************************************
====這段內(nèi)容是根據(jù)自己的實際情況修改的內(nèi)容,與上面一段二者選一,大家試一下吧===
編輯/etc/rc.d/init.d/proftpd
修改
- PATH="$PATH:/usr/local/sbin"
為
- PATH="$PATH:/usr/local/proftpd/sbin"
======================================================================================
- # 然后運行命令:
- [root@localhost /]# chkconfig --level 35 proftpd on
- # 則下次系統(tǒng)啟動以后,proftpd將自動啟動。
- # 通過如下命令啟動proftpd:
- [root@ftpd /]# /etc/rc.d/init.d/proftpd start
- 這時候可以通過如下命令來測試proftpd是否正常運行:
- [root@homeserver usr]# ftp 192.168.1.20
- Connected to 192.168.1.20.
- 220 192.168.1.20 FTP server ready
- 500 AUTH not understood
- 500 AUTH not understood
- KERBEROS_V4 rejected as an authentication type
- Name (192.168.1.20:phoebus): softsoul
- 331 Password required for softsoul.
- Password:
- 230 User softsoul logged in.
- Remote system type is UNIX.
- Using binary mode to transfer files.
- ftp>
【編輯推薦】