- 论坛徽章:
- 0
|
经过测试mod_mysql使用proftpd1.2.8自己的modules就可以,不需要使用mod_sql-4.08.tar.gz,使用的话在1.2.8编译的时候会报错,只要修改contrib/mod_sql_mysql.c文件#include <mysql/mysql.h>; 把他该为你实际路径
./configure --prefix=/usr/local/proftpd --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/include/mysql --with-libraries=/usr/lib/mysql
进行编译:
make
安装:
make install
按照精华贴中见表修改proftpd.conf文件auth_mod_mysql是有效的
use ftp;
create table ftpusers (
userid TEXT NOT NULL,
passwd TEXT NOT NULL,
uid INT NOT NULL,
gid INT NOT NULL,
home TEXT,
shell TEXT
);
create table ftpgrps (
grpname TEXT NOT NULL,
gid INT NOT NULL,
members TEXT NOT NULL
);
create table quotalimits (
name VARCHAR(30),
quota_type ENUM("user", "group", "class", "all" NOT NULL,
per_session ENUM("false", "true" NOT NULL,
limit_type ENUM("soft", "hard" NOT NULL,
bytes_in_avail FLOAT NOT NULL,
bytes_out_avail FLOAT NOT NULL,
bytes_xfer_avail FLOAT NOT NULL,
files_in_avail INT UNSIGNED NOT NULL,
files_out_avail INT UNSIGNED NOT NULL,
files_xfer_avail INT UNSIGNED NOT NULL
);
INSERT INTO ftpusers (userid, passwd, uid, gid, home, shell) values ('user1', '999999', '1000', '1000', '/home/ftp/user1', '');
INSERT INTO quotalimits (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) values ('user1', 'user', 'false', 'soft', '10240000', '0', '2048000', '500', '0', '10');
建立好的表如下
mysql>; desc ftpusers;
+--------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------+------+-----+---------+-------+
| userid | text | | | | |
| passwd | text | | | | |
| uid | int(11) | | | 0 | |
| gid | int(11) | | | 0 | |
| home | text | YES | | NULL | |
| shell | text | YES | | NULL | |
+--------+---------+------+-----+---------+-------+
mysql>; desc ftpgrps;
+---------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------+------+-----+---------+-------+
| grpname | text | | | | |
| gid | int(11) | | | 0 | |
| members | text | | | | |
+---------+---------+------+-----+---------+-------+
mysql>; desc quotalimits;
+------------------+------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+------------------------------------+------+-----+---------+-------+
| name | varchar(30) | YES | | NULL | |
| quota_type | enum('user','group','class','all') | | | user | |
| per_session | enum('false','true') | | | false | |
| limit_type | enum('soft','hard') | | | soft | |
| bytes_in_avail | float | | | 0 | |
| bytes_out_avail | float | | | 0 | |
| bytes_xfer_avail | float | | | 0 | |
| files_in_avail | int(10) unsigned | | | 0 | |
| files_out_avail | int(10) unsigned | | | 0 | |
| files_xfer_avail | int(10) unsigned | | | 0 | |
+------------------+------------------------------------+------+-----+---------+-------+
使用-n -d5 来看ftpd服务有如下输出:
[root@m1 sbin]# ./proftpd -n -d5
- parsing '/usr/local/proftpd/etc/proftpd.conf' configuration
- <Directory />;: adding section for resolved path '/'
m1.xxxx.com.cn -
m1.xxxx.com.cn - Config for ProFTPD Mysql+Quota TEST:
m1.xxxx.com.cn- ~ftp/
m1.xxxx.com.cn - Limit
m1.xxxx.com.cn - DenyAll
m1.xxxx.com.cn - UserName
m1.xxxx.com.cn - GroupName
m1.xxxx.com.cn - UserAlias
m1.xxxx.com.cn- MaxClients
m1.xxxx.com.cn - DisplayLogin
m1.xxxx.com.cn - DisplayFirstChdir
m1.xxxx.com.cn - Umask
m1.xxxx.com.cn - SQLConnectInfo
m1.xxxx.com.cn - SQLAuthTypes
m1.xxxx.com.cn - RequireValidShell
m1.xxxx.com.cn - SQLAuthenticate
m1.xxxx.com.cn - SQLHomedirOnDemand
m1.xxxx.com.cn - SQLNamedQuery_get-quota-limit
m1.xxxx.com.cn - SQLNamedQuery_get-quota-tally
m1.xxxx.com.cn - SQLNamedQuery_update-quota-tally
m1.xxxx.com.cn - SQLNamedQuery_insert-quota-tally
m1.xxxx.com.cn - /
m1.xxxx.com.cn - AllowOverwrite
m1.xxxx.com.cn - Umask
m1.xxxx.com.cn - SQLConnectInfo
m1.xxxx.com.cn - SQLAuthTypes
m1.xxxx.com.cn - RequireValidShell
m1.xxxx.com.cn - SQLAuthenticate
m1.xxxx.com.cn - SQLHomedirOnDemand
m1.xxxx.com.cn - SQLNamedQuery_get-quota-limit
m1.xxxx.com.cn - SQLNamedQuery_get-quota-tally
m1.xxxx.com.cn - SQLNamedQuery_update-quota-tally
m1.xxxx.com.cn - SQLNamedQuery_insert-quota-tally
m1.xxxx.com.cn - DefaultServer
m1.xxxx.com.cn - Umask
m1.xxxx.com.cn - QuotaDirectoryTally
m1.xxxx.com.cn - QuotaDisplayUnits
m1.xxxx.com.cn - QuotaEngine
m1.xxxx.com.cn - QuotaShowQuotas
m1.xxxx.com.cn - UserID
m1.xxxx.com.cn - UserName
m1.xxxx.com.cn - GroupID
m1.xxxx.com.cn - GroupName
m1.xxxx.com.cn - SQLConnectInfo
m1.xxxx.com.cn - SQLAuthTypes
m1.xxxx.com.cn - SQLUserTable
m1.xxxx.com.cn - SQLUsernameField
m1.xxxx.com.cn - SQLPasswordField
m1.xxxx.com.cn - SQLUidField
m1.xxxx.com.cn - SQLGidField
m1.xxxx.com.cn - SQLHomedirField
m1.xxxx.com.cn - SQLShellField
m1.xxxx.com.cn - RequireValidShell
m1.xxxx.com.cn - SQLAuthenticate
m1.xxxx.com.cn - SQLHomedirOnDemand
m1.xxxx.com.cn - SQLNamedQuery_get-quota-limit
m1.xxxx.com.cn - SQLNamedQuery_get-quota-tally
m1.xxxx.com.cn - SQLNamedQuery_update-quota-tally
m1.xxxx.com.cn - SQLNamedQuery_insert-quota-tally
m1.xxxx.com.cn - QuotaLimitTable
m1.xxxx.com.cn - QuotaTallyTable
m1.xxxx.com.cn - ProFTPD 1.2.8 (stable) (built 日 3月 30 14:34:22 CST 2003) standalone mode STARTUP |
|