LinuxSir.cn,穿越时空的Linuxsir!

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

PROFTPD服务通过MYSQL进行身分验证的原理 [原创]

[复制链接]
发表于 2003-6-24 16:55:53 | 显示全部楼层 |阅读模式
我有使用MYSQL进行身份验证,搭建PROFTPD服务器的经验,在这里写出来与大家分享。希望有不足之处还请高人指点。

环境:
Redhat9.0
ProFTPD 1.2.9rc.1
mysql-3.23.54a

步骤:
(1) 安装MySQL的rpm
# apt-get install MySQL
# apt-get install MySQL-client
# apt-get install MySQL-devel
# apt-get install MySQL-shared

(2)建立"proftpd"的数据库
(3)建立用户“proftpd”,属性设置为SELECT
(4)建立“proftpd”数据库的table:“groups”和“users”
table 的构造如下:

CREATE TABLE groups (
groupname varchar(30) NOT NULL default '',
gid int(11) NOT NULL default '1000',
members varchar(255) default NULL
UNIQUE KEY gid (gid)
PRIMARY KEY (groupname)
) TYPE=MyISAM;

CREATE TABLE users (
userid varchar(30) NOT NULL default '',
password varchar(30) NOT NULL default '',
uid int(11) NOT NULL auto_increment,
gid int(11) NOT NULL default '1000',
homedir varchar(255) default NULL,
shell varchar(255) default '/bin/true',
UNIQUE KEY uid (uid),
PRIMARY KEY (userid)
) TYPE=MyISAM;

(5)user和 group的 record生成

INSERT INTO groups VALUES ('ftpusers',1000,'');
INSERT INTO users VALUES ('user1','pass1',1000,1000,'/home/test','/bin/true');

(6)安装proftpd的source rpm
# apt-get source proftpd

(7)打开proftpd.spec, 在 --with-modules= 一行中追加:

mod_sql:mod_sql_mysql

(8)使用编辑后的proftpd.spec,做成rpm 包:
# rpm -bb proftpd.spec

(9)安装在(8)制作的rpm包:
# rpm -ivh proftpd.1.2.9rc.1.rpm

(10)在 /etc/proftpd.conf 中追加以下数据:(但是要注意根据自己的环境而定。比如说SQLConnectInfo,SQLAuthTypes)


<Global>
  DefaultRoot           ~
  SQLConnectInfo        proftpd@localhost:3306 proftp ****
  SQLAuthTypes          Plaintext
  SQLUserInfo           users userid password uid gid homedir shell
  SQLGroupInfo          groups groupname gid members
  SQLAuthenticate       on
  SQLHomedirOnDemand    on
</Global>

(11) 编辑/etc/shells ,追加在FTP下使用的shell.
(12)根据个人的喜好,设置 proftpd 由 standalone启动还是inetd启动。

以上完成。

感想: 我对数据库的管理和运用并不是很熟悉,采取webmin省了很多时间。建议和我一样“菜”的兄弟采取我的办法,可以省下不少时间。
发表于 2003-6-24 17:18:30 | 显示全部楼层
安装psotfix干嘛用的?
 楼主| 发表于 2003-6-24 17:25:10 | 显示全部楼层
对比起,笔误。已经改过来了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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