|
楼主 |
发表于 2005-6-5 22:16:05
|
显示全部楼层
我是想建一个mysql的数据库,用里面的数据做用户登陆,可是一个用户一不让登陆,530错误!!怎么办,
我是根据tony的帖子做的,如下:
使用MySQL认证ProFTPD用户:
1. apt-get update //更新数据库
2. apt-get mysql-client mysql-server //安装MySQL
3. apt-get proftpd-mysql //安装支持MySQL的ProFTPD
说明:
像其它守护程序一样,vsftpd提供了standalone和 inetd(inetd或xinetd)两种运行模式。简单 解释一下,standalone一次性启动,运行期间一直驻留在内存中,优点是对接入信号反应快,缺点是损耗了一定的系统资源,因此经常应用于对实时反应要求较高的专业FTP服务器。inetd恰恰相反,由于只在外部连接发送请求时才调用FTP进程,因此不适合应用在同时连接数量较多的系统
4. mysql -uroot -p //用Root登录MySQL,
create database ftpdb //建ftpdb 数据库
grant select, update on ftpdb.* to proftpd@"%" identified by 'password' //新增一个用户,用于存取ftpdb 数据库,用户名 proftpd,密码 password
use ftpdb //对 ftpdb 库操作
ftpgroup的表结构
CREATE TABLE `ftpgroup` ( `groupname` varchar(16) NOT NULL default , `gid` smallint(6) NOT NULL default '5500', `members` varchar(16) NOT NULL default , KEY `groupname` (`groupname`) ) TYPE=MyISAM;
插入一条记录
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpuser');
ftpuser的表结构
CREATE TABLE `ftpuser` ( `id` int(10) unsigned NOT NULL auto_increment, `userid` varchar(32) NOT NULL default , `passwd` varchar(32) NOT NULL default , `uid` smallint(6) NOT NULL default '5500', `gid` smallint(6) NOT NULL default '5500', `homedir` varchar(255) NOT NULL default , `shell` varchar(16) NOT NULL default '/sbin/nologin', `count` int(11) NOT NULL default '0', `accessed` datetime NOT NULL default '0000-00-00 00:00:00', `modified` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) TYPE=MyISAM ;
插入一条记录
INSERT INTO ftpuser (userid, passwd, uid, gid, homedir, shell) VALUES ('ftpuser', 'ftppasswd', 5501, 5500, '/tony','/sbin/nologin'); //目录/tony应该存在
5.修改/etc/proftpd.conf 加入以下内容:
DefaultRoot ~ SQLAuthTypes Plaintext Crypt SQLAuthenticate users* groups* SQLConnectInfo ftpdb@localhost proftpd password SQLUserInfo ftpuser userid passwd uid gid homedir shell SQLGroupInfo ftpgroup groupname gid members SQLMinID 500 SQLHomedirOnDemand on SQLLog PASS updatecount SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser SQLLog STOR,DELE modified SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser DeferWelcome on RootLogin off RequireValidShell off
6. /etc/init.d/proftpd stop /etc/init.d/proftpd start //使用/etc/init.d/proftpd restart 似乎不能达到预期的效果
7.使用 用户名:ftpuser 密码:ftppasswd 测试
条目 |
|