pur-ftpd在ubuntu上的安装2(数据库管理)

1.安装mysql数据库支持的pure-ftpd

apt-get install pure-ftpd-mysql

 

2.添加分组"ftpgroup",并且添加分组虚拟用户"ftpuser"

groupadd -g 2001 ftpgroup

 

useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser

 

3.创建pureftpd数据库并且建表users

mysql -u root -p

 

 

create database pureftpd;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'ftpdpass';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost.localdomain' IDENTIFIED BY 'ftpdpass';
FLUSH PRIVILEGES;

 

CREATE TABLE users (
User VARCHAR(16) BINARY NOT NULL,
Password VARCHAR(64) BINARY NOT NULL,
Uid INT(11) NOT NULL default '-1',
Gid INT(11) NOT NULL default '-1',
Dir VARCHAR(128) BINARY NOT NULL,
PRIMARY KEY (User)
);

4.修改pureftpd的数据库配置文件

vi /etc/pure-ftpd/db/mysql.conf
MYSQLServer     localhost
MYSQLPort       3306
MYSQLSocket     /tmp/mysql.sock
MYSQLUser       pureftpd
MYSQLPassword   ftpdpass     
MYSQLDatabase   pureftpd
MYSQLCrypt      md5
MYSQLGetPW      SELECT Password FROM users WHERE User="\L"
MYSQLGetUID     SELECT Uid FROM users WHERE User="\L"
MYSQLGetGID     SELECT Gid FROM users WHERE User="\L"
MYSQLGetDir     SELECT Dir FROM users WHERE User="\L"

5.修改pureftpd配置文件

echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone
echo "yes" > /etc/pure-ftpd/conf/CreateHomeDir
echo "yes" > /etc/pure-ftpd/conf/DontResolve

6.重启pureftpd

/etc/init.d/pure-ftpd-mysql restart

7.添加ftp用户

mysql -uroot -p

use pureftpd

insert into users values('user',md5('password'),2001,2001,'/home/webhome')

参考文章:http://www.howtoforge.com/virtual-hosting-with-pureftpd-and-mysql-incl-quota-and-bandwidth-management-on-ubuntu-12.10

 

posted on 2014-05-23 21:28  honsen  阅读(256)  评论(0编辑  收藏  举报

导航