FTP服务器之pure

1.    Mysql的连接      

 [root@localhost ~]# mysql -uroot -pxxxxxx(your mysql password)

2.    建立mysql认证数据库

1mysql>create database pureftpd; 2mysql>grant privileges all on pureftpd.* to pureftpuser@localhost identified by 'pureftpuser'; 3mysql>flush privileges; 4mysql>use pureftpd; 5Mysql> create table if not exists `users`( 6 `user` varchar(16) not null default '', 7 `password` varchar(32) not null default '', 8 `uid` int(11) not null, 9 `gid` int (11) not null, 10 `dir` varchar(128) not null default '', 11 `quotafiles` int(10) not null default '500', 12 `quotasize` int(10) not null default '30', 13 `ulbandwidth` int(10) not null default '80', 14 `dlbandwidth` int(10) not null default '80', 15 `ipaddress` varchar(15) not null default '*', 16 `comment` tinytext, 17 `status` enum('0','1') not null default '1', 18 `ulratio` smallint(5) not null default '1', 19 `dlratio` smallint(5) not null default '1', 20 primary key (`user`), 21 unique key `user` (`user`) 22 )engine=innodb default charset=utf8; 23mysql> show tables; 24+--------------------+ 25| Tables_in_pureftpd | 26+--------------------+ 27| users | 28+--------------------+ 291 row in set (0.00 sec) 30mysql> desc users; 31+-------------+---------------+------+-----+---------+-------+ 32| Field | Type | Null | Key | Default | Extra | 33+-------------+---------------+------+-----+---------+-------+ 34| user | varchar(16) | NO | PRI | | | 35| password | varchar(32) | NO | | | | 36| uid | int(11) | NO | | NULL | | 37| gid | int(11) | NO | | NULL | | 38| dir | varchar(128) | NO | | | | 39| quotafiles | int(10) | NO | | 500 | | 40| quotasize | int(10) | NO | | 30 | | 41| ulbandwidth | int(10) | NO | | 80 | | 42| dlbandwidth | int(10) | NO | | 80 | | 43| ipaddress | varchar(15) | NO | | * | | 44| comment | tinytext | YES | | NULL | | 45| status | enum('0','1') | NO | | 1 | | 46| ulratio | smallint(5) | NO | | 1 | | 47| dlratio | smallint(5) | NO | | 1 | | 48+-------------+---------------+------+-----+---------+-------+ 4914 rows in set (0.15 sec) 50 51 52 53 54 55 56 57

3    创建pureftp虚拟用户

1mysql> insert into users values ('bev','pureftpuser','2000','2000','/var/pureftp/bev','500','30','30','50','*','','1','1','1'); 2mysql> select * from users\G; 3*************************** 1. row *************************** 4 user: bev 5 password: 5bc915d575ad9c57aa0fc6e1fd719615 6 uid: 2000 7 gid: 2000 8 dir: /var/pureftp/bev 9 quotafiles: 500 10 quotasize: 30 11ulbandwidth: 30 12dlbandwidth: 50 13 ipaddress: * 14 comment: 15 status: 1 16 ulratio: 1 17 dlratio: 1 181 row in set (0.11 sec) 19 20ERROR: 21No query specified

4.    注意mysql账户密码的加密方式需要与pureftp支持的机密方式相吻合,不然会出现530错误

mysql> update users set password=md5('pureftpuser') where user='bev';

        我在这里选择的MD5加密方式,那么在下面配置pureftp的加密方式时一定选择MD5。

5.    修改pureftp关于mysql模块的配置文档

1[root@localhost ~]# vi /usr/local/pure-ftpd/etc/pure-ftpd.conf 2# MySQL configuration file (see README.MySQL) 3 4MySQLConfigFile /usr/local/pure-ftpd/etc/pureftpd-mysql.conf 5 6保存退出 7[root@localhost ~]# vi /usr/local/pure-ftpd/etc/pureftpd-mysql.conf 8# Optional : define the location of mysql.sock if the server runs on this host. 9MYSQLSocket /var/lib/mysql/mysql.sock(设置成你的mysql.sock路径) 10# Mandatory : user to bind the server as. 11MYSQLUser pureftpuser 12# Mandatory : user password. You must have a password. 13MYSQLPassword pureftpuser 14# Mandatory : database to open. 15MYSQLDatabase pureftpd 16# Mandatory : how passwords are stored 17# Valid values are : "cleartext", "crypt", "sha1", "md5" and "password" 18# ("password" = MySQL password() function) 19# You can also use "any" to try "crypt", "sha1", "md5" *and* "password" 20MYSQLCrypt md5 21 22MYSQLGetPW SELECT Password FROM users WHERE User='\L' 23MYSQLGetUID SELECT Uid FROM users WHERE User='\L' 24MYSQLGetGID SELECT Gid FROM users WHERE User='\L' 25MYSQLGetDir SELECT Dir FROM users WHERE User='\L' 26MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User='\L' 27MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User='\L' 28MySQLGetRatioUL SELECT ULRatio FROM users WHERE User='\L' 29MySQLGetRatioDL SELECT DLRatio FROM users WHERE User='\L' 30MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User='\L' 31MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User='\L'

6.    重启pureftp,测试刚刚建立的bev是否生效了。

好了,下篇博客,将简单总结下pureftp搭建过程中遇见的问题,及其解决办法。

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

Java修道之路,问鼎巅峰,我辈代码修仙法力齐天

<center<fontcolor00FF7Fsize5face"黑体"代码尽头谁为峰,一见秃头道成空。</font<center<fontcolor00FF00size5face"黑体"编程修真路破折,一步一劫渡飞升。</font众所周知,编程修真有八大境界:1.Javase练气筑基2.数据库结丹3.web前端元婴4.Jav

Python3:sqlalchemy对mysql数据库操作,非sql语句

Python3:sqlalchemy对mysql数据库操作,非sql语句python3authorlizmdatetime2018020110:00:00coding:utf8'''

FTP服务器之pure - HelloWorld