LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2815|回复: 29

关于用mysql和proftpd结合.谁能看懂这文章?

[复制链接]
发表于 2002-5-22 10:27:20 | 显示全部楼层 |阅读模式
全是英文的
我看起来很吃力..
唉..:confused:


=====================================
1. How do I use ProFTPD with mod_sql?
=====================================

The current supported version of mod_sql is distributed with ProFTPD.

Everything in this tarball belongs in the contrib subdirectory of the
ProFTPD source tree:

# cd contrib
# tar -xzvf mod_sql-3.2.3.tar.gz

To build ProFTPD with mod_sql support, call configure with the
following arguments (for example):

If you're using the MySQL backend:

./configure --with-modules=mod_sql:mod_sql_mysql

If you're using the Postgres backend:

./configure --with-modules=mod_sql:mod_sql_postgres

You will need to tell configure how to find your database-specific
libraries and header files; I use the MySQL backend and call configure
like this:

./configure --with-modules=mod_sql:mod_sql_mysql \
            --with-includes=/usr/local/include \
            --with-libraries=/usr/local/lib/mysql

Now, read the Directives section below.

===================================================
2. How do I setup my database for use with mod_sql?
===================================================

I'm assuming you know how to use your database system.  

At the minimum, mod_sql must be able to access a table with two
columns: userid and passwd.  For full functionality, you probably need
to do more, including creating another database table to hold group
information.

In the following table headings, 'COLUMN' is the column name, 'TYPE'
is the datatype expected (text or numeric), 'R' means "required
column", 'N' means "if this column exists, are NULL values
allowed". and 'USE' gives a *very* brief description of what goes in
there.


USERTABLE:  This table *MUST* exist in the database.

COLUMN                TYPE        R        N        USE
---------------------------------------------------------
userid                text        Y        N        user's login id
uid                num        N        Y        user's uid
gid                num        N        Y        user's gid
passwd                text        Y        N        user's password
shell                text        N        Y        user's shell
homedir**        text        N        Y        user's homedir
count                num        N        N        login counter

**see the description of the directives SQLHomedir and SQLHomedirField



GROUPTABLE:  For full functionality of this module, this table should
exist.  If you elect *NOT* to create it, you *MUST* set the
'SQLDoGroupAuth' directive to 'OFF'.

COLUMN                TYPE        R        N        USE
---------------------------------------------------------
groupname        text        Y        N        group's name
gid                num        Y        N        group's gid
members                text        Y        Y        group's members

Note: multiple members per group must be separated by commas and
should not include whitespace.

Note: mod_sql will concatenate all matching group rows -- that is, you
can have multiple rows for each group with only one member per group,
or you can have a single row with multiple groups, or you can mix and
match.
发表于 2002-5-22 10:39:03 | 显示全部楼层
等北南兄吧,北南兄的E文很棒
 楼主| 发表于 2002-5-23 10:49:23 | 显示全部楼层
今天用东方快车的全文翻译
看懂了一点
 楼主| 发表于 2002-5-23 10:55:29 | 显示全部楼层
关于proftpd的关于与mysql结合的全文解释在这里
是英文的
我是不会做了
发表于 2002-5-23 13:24:42 | 显示全部楼层
我刚刚做了一个,感觉不错。不知道你有什么问题?
发表于 2002-5-23 14:07:48 | 显示全部楼层
我把我安装、配置的过程介绍一下,希望对有此需求的朋友有帮助。
一、得到安装包
proftpd的最新版是1.2.5rc2,下载地址是:
ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.5rc2.tar.bz2
它自带的mod_sql版本是4.07,有一个漏洞,我们用最新的4.08版,下载地址在:
http://www.lastditcheffort.org/~ ... mod_sql-4.08.tar.gz

二、编译安装
将proftpd的源码包解压缩到某临时目录下:
[root@test /tmp]# tar jxvf proftpd-1.2.5rc2.tar.bz2
进入mod_sql所在目录:
[root@test /tmp]# cd proftpd-1.2.5rc2/contrib/
解压缩mod_sql 4.08版,覆盖老版本:
[root@test /tmp/proftpd-1.2.5rc2/contrib]# tar zxvf mod_sql-4.08.tar.gz
进入proftpd源代码主目录:
[root@test /tmp/proftpd-1.2.5rc2/contrib]# cd ..
执行configure配置程序:
[root@test /tmp/proftpd-1.2.5rc2]# ./configure --prefix=/usr/local/proftpd --with-modules=mod_sql:mod_sql_mysql
编译:
[root@test /tmp/proftpd-1.2.5rc2]# make
安装:
[root@test /tmp/proftpd-1.2.5rc2]# make install

三、配置proftpd
将mod_sql包含的proftpd默认配置文件拷贝到proftpd的配置文件目录中:
[root@test /tmp/proftpd-1.2.5rc2]# mv /usr/local/proftpd/etc/proftpd.conf /usr/local/proftpd/etc/proftpd.conf.BAK
[root@test /tmp/proftpd-1.2.5rc2]# cp contrib/mod_sql.conf /usr/local/proftpd/etc/proftpd.conf
修改配置文件/usr/local/proftpd/etc/proftpd.conf中的以下内容:
修改
SQLConnectInfo dbname@host:port username password
为你的数据库的相应连接参数。

  SQLUserInfo users username password uid gid NULL NULL
改为
  SQLUserInfo users userid passwd uid gid homedir shell
这是使用FTP帐号的表名和字段名。

  SQLDefaultHomedir "/tmp"
的行首加上“#”注释符。

# SQLGroupInfo groups groupname gid members
前面的“#”注释符去掉,这是组信息。

如果不需要匿名登录,将
<Anonymous ~ftp>

</Anonymous>
之间的内容前都加上“#”注释符。


四、建立数据库
在第三步中的dbname库中用以下命令建立相应的数据表,并建立一个帐号:

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;

INSERT INTO `groups` VALUES ('ftpgroup', 10000, 'ftpuser');

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,
  PRIMARY KEY  (`userid`)
) TYPE=MyISAM;

INSERT INTO `users` VALUES ('ftpuser', password('ftpuser'), 10000, 10000, '/home/ftpuser', '/bin/bash', 0);

五、启动proftpd
[root@test /root]# /usr/local/proftpd/bin/proftpd

OK,试试吧~~~
发表于 2002-5-23 14:17:53 | 显示全部楼层
proftpd中关于mod_sql的选项很多,以上只是最基本的选项,所有选项如下,有举的朋友可以仔细研究研究:
SQLAuthenticate
SQLAuthoritative
SQLAuthTypes
SQLConnectInfo
SQLDefaultGID
SQLDefaultHomedir
SQLDefaultUID
SQLDoAuth
SQLDoGroupAuth
SQLEmptyPasswords
SQLEncryptedPasswords
SQLGidField
SQLGroupGIDField
SQLGroupInfo
SQLGroupMembersField
SQLGroupnameField
SQLGroupTable
SQLGroupWhereClause
SQLHomedir
SQLHomedirField
SQLHomedirOnDemand
SQLLog
SQLLogDirs
SQLLogHits
SQLLogHosts
SQLLoginCountField
SQLLogStats
SQLMinID
SQLMinUserGID
SQLMinUserUID
SQLNamedQuery
SQLPasswordField
SQLProcessGrEnt
SQLProcessPwEnt
SQLRatios
SQLRatioStats
SQLScrambledPasswords
SQLShellField
SQLShowInfo
SQLSSLHashedPasswords
SQLUidField
SQLUserInfo
SQLUsernameField
SQLUserTable
SQLUserWhereClause
SQLWhereClause
发表于 2002-5-23 16:11:36 | 显示全部楼层
多谢小凡兄为兄弟们吃螃蟹啦。。。。
这就回去试试!
 楼主| 发表于 2002-5-23 17:41:37 | 显示全部楼层
出错了..
我在做make这步时出错
cd lib ; make lib
make[1]: Entering directory `/root/proftpd-1.2.5rc2/lib'
make[1]: Nothing to be done for `lib'.
make[1]: Leaving directory `/root/proftpd-1.2.5rc2/lib'
cd src ; make src
make[1]: Entering directory `/root/proftpd-1.2.5rc2/src'
make[1]: Nothing to be done for `src'.
make[1]: Leaving directory `/root/proftpd-1.2.5rc2/src'
cd modules; make modules
make[1]: Entering directory `/root/proftpd-1.2.5rc2/modules'
make[1]: Nothing to be done for `modules'.
make[1]: Leaving directory `/root/proftpd-1.2.5rc2/modules'
gcc -Llib  -o proftpd src/main.o src/timers.o src/sets.o src/pool.o src/dirtree.o src/support.o src/inet.o src/log.o src/io.o src/ident.o src/data.o src/modules.o src/auth.o src/fs.o modules/mod_core.o modules/mod_xfer.o modules/mod_unixpw.o modules/mod_auth.o modules/mod_ls.o modules/mod_log.o modules/mod_site.o modules/mod_pam.o modules/mod_sql_mysql.o modules/mod_sql.o  modules/module_glue.o -lsupp -lcrypt  -lm -lz -lmysqlclient  -lpam
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [proftpd] Error 1
 楼主| 发表于 2002-5-23 17:42:54 | 显示全部楼层
我是用的Redhat7.3
软件是用的你上面的提供的下载的软件..
1.25+sql 4.08
是需要其它什么吗
事先要先配置什么?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表