当前位置:操作系统 > Unix/Linux >>

Pure-FTPd+LDAP+MySQL+PGSQL+Virtual-Users+QuotaHowTo

本文使用环境:Redhat linux

  1 准备工作... 3

  1.1 安装MySQL数据库... 3

  1.2 安装PostgreSQL 数据库... 3

  1.3 安装OpenLDAP. 4

  2 安装Pure-FTPd. 4

  3 配置pure-ftpd.conf 5

  4 运行pureftpd. 5

  5 MySQL模块... 5

  5.1 创建MySQL数据库... 5

  5.2 配置pureftpd-mysql.conf 6

  5.3 测试pureftpd. 7

  6 PGSQL模块... 8

  6.1 配置PostgreSQL 数据库... 8

  6.1.1 postgresql.conf 8

  6.1.2 pg_hba.conf 8

  6.1.3 Restart PostgreSQL. 8

  6.2 创建PostgreSQL 数据库... 8

  6.3 配置pureftpd-pgsql.conf 10

  6.4 测试pureftpd. 12

  7 LDAP模块... 12

  7.1 配置OpenLDAP. 12

  7.2 rootdn的结构... 12

  7.3 创建dn. 13

  7.4 pureftpd-ldap.conf 14

  7.5 测试pureftpd. 14

  8 Virtual-Users. 14

  9 配置文件实例... 16

  9.1 pure-ftpd.conf 16

  9.2 pureftpd-ldap.conf 26

  9.3 pureftpd-mysql.conf 27

  9.4 pureftpd-pgsql.conf 30

  9.5 pureftpd.passwd. 32

  10 FAQ.. 33

  10.1 不能访问http://www.pureftpd.org/ 33

  10.2 目录与OpenSource RDBMS比较... 33

  10.3 产生Crypt密码... 33

  10.3.1 使用C产生... 33

  10.3.2 使用PHP产生... 34

  10.3.3 使用perl产生... 34

  10.3.4 使用SQL语句产生... 34

  10.3.5 使用Java产生... 35

  11 参考资料... 35

  12 声明... 35

  1 准备工作

  [root@linux root]# wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.15.tar.gz

  [root@linux root]# wget http://home.9812.net/linux/download/myphp/site-2.1.0.tar.gz

  mysql : http://www.mysql.com

  pgsql: http://www.postgresql.org

  openldap: http://www.openldap.org

  1.1 安装MySQL数据库

  [root@linux mysql]$ cat install

  rpm -Uvh MySQL-server-4.0.13-0.i386.rpm

  rpm -Uvh MySQL-client-4.0.13-0.i386.rpm

  rpm -Uvh MySQL-devel-4.0.13-0.i386.rpm

  rpm -Uvh MySQL-shared-4.0.13-0.i386.rpm

  rpm -Uvh MySQL-shared-compat-4.0.13-0.i386.rpm

  [root@linux root]# service mysql start

  1.2 安装PostgreSQL 数据库

  [root@linux pgsql]$ cat install

  rpm -Uvh --nodeps postgresql-libs-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-devel-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-server-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-contrib-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-docs-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-jdbc-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-pl-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-python-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-tcl-?.?.?-1PGDG.i386.rpm

  rpm -Uvh --nodeps postgresql-test-?.?.?-1PGDG.i386.rpm

  [root@linux root]# rpm -qa|grep post

  [root@linux root]# service postgresql start

  1.3 安装OpenLDAP

  [root@linux ldap]$ cat install

  rpm -ivh openldap-servers-2.0.25-1.i386.rpm

  rpm -ivh openldap-clients-2.0.25-1.i386.rpm

  rpm -ivh openldap-2.0.25-1.i386.rpm

  rpm -ivh openldap12-1.2.13-5.i386.rpm

  rpm -ivh openldap-devel-2.0.25-1.i386.rpm

  [root@linux root]# service ldap start

  2 安装Pure-FTPd

  [root@linux root]# tar zxvf pure-ftpd-1.0.15.tar.gz

  [root@linux root]# cd pure-ftpd-1.0.15

  [root@linux pure-ftpd-1.0.15]#./configure \\

  --prefix=/usr/local/pureftpd \\

  --with-ldap \\

  --with-mysql \\

  --with-pgsql \\

  --with-puredb

  --with-shadow \\

  --with-pam \\

  --with-paranoidmsg \\

  --with-welcomemsg \\

  --with-uploadscript \\

  --with-cookie \\

  --with-virtualchroot

  --with-virtualhosts \\

  --with-virtualroot \\

  --with-diraliases \\

  --with-quotas \\

  --with-sysquotas \\

  --with-ratios \\

  --with-ftpwho \\

  --with-throttling \\

  --with-language=simplified-chinese

  [root@linux pure-ftpd-1.0.15]#make

  [root@linux pure-ftpd-1.0.15]#make check

  [root@linux pure-ftpd-1.0.15] #make install

  [root@linux pure-ftpd-1.0.15]# cd configuration-file

  [root@linux configuration-file]# chmod u+x pure-config.pl

  [root@linux configuration-file]# cp pure-config.pl /usr/local/pureftpd/bin

  [root@linux configuration-file]# cp pure-ftpd.conf /usr/local/pureftpd/etc

  [root@linux configuration-file]# cd ..

  [root@linux pure-ftpd-1.0.15]# cp pureftpd* /usr/local/pureftpd/etc/

  3 配置pure-ftpd.conf

  # LDAP configuration file (see README.LDAP)

  LDAPConfigFile /usr/local/pureftpd/etc/pureftpd-ldap.conf

  # MySQL configuration file (see README.MySQL)

  MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf

  # Postgres configuration file (see README.PGSQL)

  PGSQLConfigFile /usr/local/pureftpd/etc/pureftpd-pgsql.conf

  # PureDB user database (see README.Virtual-Users)

  PureDB /usr/local/pureftpd/etc/pureftpd.pdb

  4 运行pureftpd

  [root@linux bin]# pure-config.pl ../etc/pure-ftpd.conf

  5 MySQL模块

  5.1 创建MySQL数据库

  CREATE DATABASE pureftpd;

  grant all on pureftpd.* to pureftpd@localhost identified by 'qKiscCbwbXAkWp.'

  DROP TABLE IF EXISTS `users`;

  CREATE TABLE `users` (

  `id` int(32) unsigned NOT NULL auto_increment,

  `User` varchar(16) NOT NULL default '',

  `Password` varchar(64) NOT NULL default '',

  `Uid` varchar(11) NOT NULL default '-1',

  `Gid` varchar(11) NOT NULL default '-1',

  `Dir` varchar(128) NOT NULL default '',

  `QuotaSize` smallint(5) NOT NULL default '0',

  `QuotaFiles` int(11) NOT NULL default '0',

  `ULBandwidth` smallint(5) NOT NULL default '0',

  `DLBandwidth` smallint(5) NOT NULL default '0',

  `ULRatio` smallint(6) NOT NULL default '0',

  `DLRatio` smallint(6) NOT NULL default '0',

  `comment` tinytext NOT NULL,

  `ipaccess` varchar(15) NOT NULL default '*',

  `status` enum('0','1') NOT NULL default '0',

  `create_date` datetime NOT NULL default '0000-00-00 00:00:00',

  `modify_date` datetime NOT NULL default '0000-00-00 00:00:00',

  PRIMARY KEY (`id`,`User`),

  UNIQUE KEY `User` (`User`)

  ) TYPE=MyISAM AUTO_INCREMENT=5 ;

  INSERT INTO `users` VALUES (5, 'test', encrypt('test'), '505', '505', '/tmp', 0, 0, 0, 0, 0, 0, '', '*', '1', '2003-06-26 18:04:33', '2003-06-26 18:04:33');

  5.2 配置pureftpd-mysql.conf

  # Mandatory : user to bind the server as.

  MYSQLUser pureftpd

  # Mandatory : user password. You must have a password.

  MYSQLPassword qKiscCbwbXAkWp.

  # Mandatory : database to open.
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,