基于mysql 验证 proftpd 安装成功。
测试发现proftpd跟SERV-U一样,无法计算实际FTP文件大小且性能上也不是很好,因为客户端每个操作都要查询或修改MYSQL数据行。
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
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.
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
ServerName "ProFTPD Default Installation"
ServerType standalone
DefaultServer on
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# Port 21 is the standard FTP port.
Port 21
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# 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
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# Set the user and group under which the server will run.
#User nobody
#Group nobody
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
User ftpUser
Group ftpGroup
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# 最大的用户数
#MaxClients 100
#MaxHostsPerUser 1
#MaxClientsPerUser 2
# 对不起,一个IP只允许一个连接
#MaxClientsPerHost 1
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
#RootLogin off
RequireValidShell off
#UseReverseDNS off
#IdentLookups off
#TimeoutStalled 600
#TimeoutLogin 900
#TimeoutIdle 600
#TimeoutNoTransfer 600
# 让proftp支持现在流行的FXP传输方式,默认是不支持的
#AllowForeignAddress on
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# 屏蔽服务器版本信息
#ServerIdent off
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
UseReverseDNS off
IdentLookups off
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
######################## 下面是磁盘限额Quota设置 ############
#启用磁盘限额
QuotaDirectoryTally on
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
#磁盘限额单位 b"|"Kb"|"Mb"|"Gb"
QuotaDisplayUnits "Mb"
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
QuotaEngine on
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
#磁盘限额日志记录
QuotaLog "/var/log/proftpd.quotalog"
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
#打开磁盘限额信息 "quote SITE QUOTA"命令
QuotaShowQuotas on
####################### 完成磁盘配额设置 ####################
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
SQLConnectInfo ftp@localhost:3306 root 123456
SQLAuthTypes Backend Plaintext
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
#指定用来做用户认证的表的有关信息。(将在后面创建)
SQLUserInfo FTPUSERS userid passwd uid gid homedir shell
SQLGroupInfo FTPGRPS groupname gid members
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
#数据库认证
SQLAuthenticate users groups usersetfast groupsetfast
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
#proftpd进行的mysql调用语句,别修改任何地方
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail,files_in_avail, files_out_avail, files_xfer_avail FROM quotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM quotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" quotatallies
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" quotatallies
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
CreateHome on
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# Normally, we want files to be overwriteable.
AllowOverwrite on
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
AllowAll
</Limit>
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# 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
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# Limit the maximum number of anonymous logins
MaxClients 10
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayChdir .message
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
# Limit WRITE everywhere in the anonymous chroot
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
proftpd 建表
CREATE TABLE FTPGRPS(
groupname text NOT NULL,
gid smallint(6) NOT NULL default 0,
members text NOT NULL
)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
INSERT INTO FTPGRPS VALUES ('FTPGRP', 2001, 'FTPUSR');
INSERT INTO FTPGRPS VALUES ('ftpusers', 2002, 'ftp');
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
CREATE TABLE FTPUSERS (
userid text NOT NULL,
passwd text NOT NULL,
uid int(11) NOT NULL default '0',
gid int(11) NOT NULL default '0',
homedir text,
shell text
)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
INSERT INTO FTPUSERS VALUES ('lcx1', '123456', 2001, 2001, '/home/www/lcx1', "");
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
CREATE TABLE quotalimits (
name varchar(30) default NULL,
quota_type enum('user','group','class','all') NOT NULL default 'user',
per_session enum('false','true') NOT NULL default 'false',
limit_type enum('soft','hard') NOT NULL default 'soft',
bytes_in_avail float NOT NULL default 0,
bytes_out_avail float NOT NULL default 0,
bytes_xfer_avail float NOT NULL default 0,
files_in_avail int(10) unsigned NOT NULL default 0,
files_out_avail int(10) unsigned NOT NULL default 0,
files_xfer_avail int(10) unsigned NOT NULL default 0
)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
CREATE TABLE quotatallies (
name VARCHAR(30) NOT NULL,
quota_type ENUM("user", "group", "class", "all") NOT NULL,
bytes_in_used FLOAT NOT NULL,
bytes_out_used FLOAT NOT NULL,
bytes_xfer_used FLOAT NOT NULL,
files_in_used INT UNSIGNED NOT NULL,
files_out_used INT UNSIGNED NOT NULL,
files_xfer_used INT UNSIGNED NOT NULL
);
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2008年8月27日
无法计算实际FTP文件大小<-----抱歉,没有深入了解他的配置,proftpd新版已经可以实时计算空间大小了。
QuotaOptions ScanOnLogin #登录时扫描用户home目录更新文件大小和数量