# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.2.tar.gz
# tar zxvf proftpd-1.3.2
# cd proftpd-1.3.2
# ./configure --prefix=/usr/local/proftpd --with-modules=mod_quotatab:mod_quotatab_file
# make
# make install
# cp contrib/ftpasswd /usr/local/proftpd/bin/
# cp contrib/ftpquota /usr/local/proftpd/bin/
# vi /usr/local/proftpd/etc/proftpd.conf
ServerName "mz16.cn Ftp System"
ServerType standalone
DefaultServer on
Port 21
# Don't use IPv6 support by default.
UseIPv6 off
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
# 不顯示服務器相關信息, 如proftpd版本
ServerIdent off
# 禁用反向域名解析
UseReverseDNS off
User nobody
Group nobody
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~ # 把用戶鎖定在自己的目錄下,根目錄無法訪問。
# Normally, we want files to be overwriteable.
AllowOverwrite on #設置文件可以被覆蓋
AllowForeignAddress on # 支持FXP
PassivePorts 49152 65534 # 支持被動模式
AllowRetrieveRestart on # 允許下載續傳,默認即開啟
AllowStoreRestart on # 允許上載續傳
RequireValidShell off # 不要求有合法shell,直接效果是允許nologin用戶和虛擬用戶登錄
AuthOrder mod_auth_file.c mod_auth_unix.c
AuthUserFile /usr/local/proftpd/etc/passwd
TransferRate STOR 150 user tom # 限制tom用戶上傳的速率限制在150Kbytes/s
TransferRate RETR 100 user tom # 限制tom用戶下載的速率限制在100Kbytes/s
# Using a file-based limit table
QuotaLimitTable file:/usr/local/proftpd/etc/ftpquota.limittab
# Using a file-based tally table
QuotaTallyTable file:/usr/local/proftpd/etc/ftpquota.tallytab
QuotaDirectoryTally on
QuotaDisplayUnits Mb # 顯示以MB為單位
QuotaEngine on
QuotaLog /usr/local/proftpd/etc/Quota.log
QuotaShowQuotas on
#QuotaOptions ScanOnLogin # 這個選項如果去掉註釋,會先掃瞄用戶目錄的大小,比如用戶目錄限定為50M,已經使用了18M,那麼只能上傳小於32M的文件,否則會失敗。如果加上這個選項,會忽略掉用戶目錄大小,上傳只要小於50M,都可以上傳。建議註釋這條選項。
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
AllowAll
</Limit>
<Directory /opt/tom/>
<Limit write>
AllowUser tom
DenyALL
</Limit>
</Directory>
# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
#<Anonymous ~ftp>
# 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
# DisplayChdir .message
# Limit WRITE everywhere in the anonymous chroot
# <Limit WRITE>
# DenyAll
# </Limit>
#</Anonymous>