Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

ProFTPD 安全配置完整教學:從安裝到匿名伺服器建置

編輯:關於伺服器

ProFTPD 簡介與優勢

ProFTPD (Professional FTP daemon) 針對 Wu-FTP 弱點開發,具備更佳安全性與豐富功能:支援 Stand-alone 與 xinetd 兩種運行模式、單一配置檔 (類 Apache 風格)、目錄級 .ftpaccess 控制、虛擬主機與匿名 FTP 易設定、非 root 身份運行、強大日誌、Shadow 密碼支援、開源 GPL 授權。目前廣泛取代 Wu-FTP 成為主流 FTP 伺服器軟體。

基本安裝步驟 (以 1.3.0 版為例)

  1. 移除舊有 wu-ftpd:rpm -e wu-ftpd
  2. 下載原始碼:wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0.tar.bz2
  3. 解壓編譯安裝:
    bunzip2 proftpd-1.3.0.tar.bz2
    tar xvf proftpd-1.3.0.tar
    cd profttd-1.3.0
    ./configure && make && make install
  4. 預設配置檔位於 /usr/local/etc/proftpd.conf

核心配置指令解析

指令說明安全建議
ServerName登入時顯示的伺服器名稱自訂,避免洩露版本資訊
ServerTypestandalone / xinetdstandalone 效能較佳
ServerIdent是否顯示軟體名稱/版本off 隱藏資訊
Port監聽埠號 (預設 21)可改用非標準埠
Umask預設檔案權限遮罩027 (擁有者讀寫,群組讀,其他無)
MaxInstances最大同時連線數standalone 模式建議設較低值 (如 30) 防禦 DoS
User/Group運行進程的用戶/群組nobody/nogroup (最小權限)
<Directory /*> AllowOverwrite是否允許覆蓋檔案off 防止惡意覆寫
<Anonymous>匿名 FTP 區塊不需時刪除整個區塊

獨立模式啟動腳本與測試

# 複製啟動腳本
cp ./contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
# 建立群組
groupadd nogroup
# 設定開機自啟
ln -s /etc/rc.d/init.d/proftpd /etc/rc.d/rc3.d/S95proftpd
# 測試連線
ftp 192.168.2.33

控制指令:service proftpd start|stop|reload

建置安全匿名 FTP 站點

僅提供小檔案下載建議用 Apache 替代;需頻繁上傳/下載才建匿名 FTP。關鍵配置:

<Anonymous ~ftp>
User ftp
Group ftp
RequireValidShell off
UserAlias anonymous ftp
MaxClients 40
<Directory *>
<Limit WRITE> DenyAll </Limit>
</Directory>
<Directory incoming>
<Limit WRITE> AllowAll </Limit>
<Limit READ> DenyAll </Limit>  
</Directory>
</Anonymous>

原理:chroot 限制使用者於站點根目錄;incoming 唯一可寫目錄,且設定 DenyAll READ 使上傳者無法列出/下載他人檔案,達「只寫不讀」安全隔離。

Copyright © Windows教程網 All Rights Reserved