承上篇,進一步限制 incoming 子目錄寫入權限僅開放給特定網段,並附完整 proftpd.conf 註解版供參考。
編輯 proftpd.conf,在 <Anonymous> 區段內 <Directory incoming> ... </Directory> 之間加入:
<Limit WRITE>
Order allow,deny
Allow from 10.0.8.
Deny from all
</Limit>
表示:10.0.8. 網段用戶擁有寫入權限,其餘全拒。若要全開放,改為 AllowAll。
ftpshut:關閉 FTP 服務,產生 /etc/shutmsg;刪除該檔恢復服務。ftpwho:顯示線上用戶名單。ftpcount:顯示線上人數。ServerName "MY REDHAT LINUX FTP"
ServerType standalone
DefaultServer on
Port 21
Umask 022
RequireValidShell off
ServerIdent off
MaxInstances 30
User nobody
Group nobody # 原為 nogroup,必須改為 nobody
AllowOverwrite on
<Anonymous /home/ftp>
User ftp
Group ftp
UserAlias anonymous ftp
MaxClients 10
DisplayLogin welcome.msg
DisplayFirstChdir .message
<Limit WRITE>
Order allow,deny
Allow from 10.0.8.
Deny from all
</Limit>
</Anonymous>
關鍵參數說明:ServerType standalone 安全性較高;ServerIdent off 隱藏版本資訊;MaxInstances 防 DoS 限制並發;UserAlias 讓 anonymous 等同 ftp 帳號。