我在Redhat7.3的环境下Proftpd1.2.5+mysql3.23.49+mod_quota.c
2004-04-23 15:18 pm来自:Linux文档
现载:Www.8s8s.coM
地址:无名
贴出我的步聚:
mod_quota.c这个文件需要vi一下.改28.29行
把QUOTA_FILE注释,然后去掉QUOTA_MYSQL前的注释
我的选项是:
./configure --prefix=/usr/local/
--with-modules=mod_sql:mod_sql_mysql
--with-includes=/usr/include/mysql
--with-libraries=/usr/lib/mysql
vi Make.modules
MODULES=mod_core.o后边加入mod_quota.o
BUILD_MODULES=modules/mod_core.o后边加上modules/mod_quota.o
然后开始编译
make
make install
3、建立数据库
#建立数据库proftpd
CREATE DATABASE proftpd;
#建立组表
DROP TABLE IF EXISTS `groups`;
CREATE TABLE `groups` (
`groupname` varchar(255) binary NOT NULL default '',
`gid` int(11) NOT NULL default '0',
`members` text NOT NULL,
PRIMARY KEY (`groupname`)
)TYPE=MyISAM;
#建立用户表
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`userid` varchar(255) binary NOT NULL default '',
`passwd` varchar(255) binary NOT NULL default '',
`uid` int(11) default NULL,
`gid` int(11) default NULL,
`homedir` varchar(255) default NULL,
`shell` varchar(255) default NULL,
`count` int(11) default NULL,
`used` double(10,1) default '0.0',
`quota` double(10,1) default '10000000.0',
PRIMARY KEY (`userid`)
) TYPE=MyISAM;
#如果表已经存在,不想删除,可以使用以下命令更改表的结构
alter table users add column used double(10,1) default '0.0';
alter table users add column quota double(10,1) default '10000000.0';
然后可以用phpmyadmin来插入记录
或直接运行此语句也行!
INSERT INTO `users` valueS ('ftpuser', 'ftpuser', 10000, 10000, '/home/ftpuser', '/bin/bash', 0, 0, 10240000);
4、配置proftpd.conf
在这里我把我的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.
ServerName "aaa"
ServerType standalone
DefaultServer on
ServerIdent on "aaa: aaa is ready. Please you login."
ServerAdmin [email protected]
Port 2121
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 002
#允许尝试3次登录
MaxLoginAttempts 3
#关于超时
TimeoutLogin 120
TimeoutIdle 600
TimeoutNoTransfer 900
TimeoutStalled 3600
#限制连接数
MaxClients 10 "最大允许10个用户同时访问"
MaxClientsPerHost 1 "对不起,一台主机只允许一个连接"
#不使用SHELL
RequireValidShell no
#允许断点续传
AllowOverwrite no
AllowStoreRestart on
#不使用反解析
UseReverseDNS off
#磁盘配额限制
Quotas on
QuotaCalc on
QuotaType soft
#默认的配额
DefaultQuota 100000
#这里默认的是一子节为单位,我改成了K
QuotaBlockSize 1024
QuotaBlockName "K bytes"
MultilineRFC2228 on
SystemLog /var/proftpd/log/proftpd.log
#MySQL的信息写入了另一个文件中
Include /var/vmysql.conf
#连接时的MSG
DisplayConnect /var/proftpd/etc/connect.msg
DisplayGoAway /var/proftpd/etc/goway.msg
#输入quit命令后的MSG
DisplayQuit /var/proftpd/etc/quit.msg
#Disable Ident protecol(RFC 1413)
IdentLookups off
#configation手册中说这是一种安全的上传模式
HiddenStor on
DisplayLogin welcome.msg
DisplayFirstChdir .message
AllowOverwrite yes
# 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
# Set the user and group that the server normally runs at.
User nobody
Group nogroup
PathDenyFilter "(.ftpaccess)|(.htaccess)$"
# Normally, we want files to be overwriteable.
AllowOverwrite on
#删除了anonymous登录的设置
vmysql.conf的内容
#mod_sql的设置
###############DATABASE@SERVER:PORT MySQL-User passwd
SQLConnectInfo proftpd@localhost root xxxxxx
SQLAuthenticate users*
#密码未加密
SQLAuthTypes Plaintext
#用户表信息
############表名 user字段名 pass uid gid 用户目录 SHELL
SQLUserInfo users userid passwd uid gid homedir shell
#组表信息
#############表名 组名字段 组值字段 成员字段
SQLGroupInfo groups groupname gid members
####用户登录后,将用户的登录次数+1
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1 WHERE userid='%u'" users
#####用户登录后,显示已经登录过的次数(特别说明,已经登录过的次数,不算当前的连接
SQLNamedQuery count SELECT "count FROM users WHERE userid='%u'"
SQLShowInfo PASS "230" "You've logged on %{count} times, %u"
###如果用户目录不存在,自动创建目录
SQLHomedirOnDemand on
#mod_quota的相关设置
#Quota信息的表名
SQLQuotaTable users
#MySQL的连接参数#Server User Password 数据库
SQLQuotaInfo localhost root xxxxxxx proftpd
#保存用户名的字段名
SQLQuotaName userid
#保存用户已经使用空间的字段名
SQLQuotaUsed used
#保存用户磁盘配额的字段名
SQLQuotaQuota quota
5、测试proftpd
启动proftpd看看吧。然后根据出现的情况作出修改。