免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 743 | 回复: 0
打印 上一主题 下一主题

pure-ftpd配置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-27 11:52 |只看该作者 |倒序浏览
确认mysql已经安装完成.用redhat的rpm包即可
将pure-ftpd-1.0.21.tar.gz拷贝到/software中
#cd /software/
# ls
pure-ftpd-1.0.21.tar.gz
# tar zxvf pure-ftpd-1.0.21.tar.gz
# cd pure-ftpd-1.0.21
#./configure \
--prefix=/usr/local/pureftpd \
--with-mysql=/usr \
--with-paranoidmsg \
--with-puredb \
--with-shadow \
--with-welcomemsg \
--with-uploadscript \
--with-quotas \
--with-cookie \
--with-pam \
--with-virtualhosts \
--with-virtualroot \
--with-diraliases \
--with-sysquotas \
--with-ratios \
--with-ftpwho \
--with-throttling \
--with-rfc2640 \
--with-language=simplified-chinese
configure: +--------------------------------------------------------+
configure: | You can subscribe to the Pure-FTPd users mailing-list  |
configure: | to ask for help and to stay informed of new releases.  |
configure: | Go to
http://www.pureftpd.org/ml/
now!                 |
configure: +--------------------------------------------------------+
出现如上面的文字,则表示安装成功!
#make
#make check
#make install
#cd configuration-file
# mkdir /usr/local/pureftpd/etc
# chmod u+x pure-config.pl
# cp pure-config.pl /usr/local/pureftpd/sbin
# cp pure-ftpd.conf /usr/local/pureftpd/etc
# cd ..
# cp pureftpd-mysql.conf /usr/local/pureftpd/etc/
------------设置环境变量----------
#  vi /etc/hosts
127.0.0.1               localhost
xxx.xxx.xxx             ftp-server
# vi /etc/profile
   if [ `id -u` = 0 ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
        pathmunge /usr/cvfs/bin
        pathmunge /usr/local/pureftpd/sbin
        pathmunge /usr/local/pureftpd/bin
  fi
# . /etc/profile
--------------------------创建pureftpd数据库和users表--------------
# mysql -u root -p
mysql> create database pureftpd;
mysql> grant all privileges on pureftpd.* to
[email=pureftpd@localhost]pureftpd@localhost[/email]
identified by "password";
mysql> use pureftpd;
mysql>
CREATE TABLE users (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
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 '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
mysql> show databases;
+----------+
| Database |
+----------+
| mysql    |
| pureftpd |
| test     |
+----------+
2 rows in set (0.00 sec)
mysql> show tables;  
+--------------------+
| Tables_in_pureftpd |
+--------------------+
| users              |
+--------------------+
1 row in set (0.00 sec)
mysql> select * from users;
mysql> quit
-------------------增加系统用户组ftpgroup和系统用户ftpuser-------------------
# groupadd ftpgroup -g 2000
# useradd -g ftpgroup -d /dev/null -s /sbin/nologin ftpuser -u 2000
----------------------创建test用户目录、目录权限、归属组-------------------
# mkdir /test
# chmod 777 /test
# chown  ftpuser:ftpgroup  /test
-------------------------增加虚拟用户数据库和用户test------------------------------------
# cd /usr/local/pureftpd/etc/
# pure-pw  useradd test  -u ftpuser -d /test
Password: (password)
Enter it again: (password)
# pure-pw mkdb
----------------------为mysql增加test数据内容-----------------------------
# mysql -u pureftpd -p
mysql> use pureftpd;
mysql> DESCRIBE users;
mysql> INSERT INTO `users` VALUES ('test', 0, 'password','2000', '2000', '/test', '0', '0', '', '*', '0', '0');
---------------------------配置pure-ftpd.conf参数--------
# cd /usr/local/pureftpd/etc
# vi pure-ftpd.conf
  
   # MySQL configuration file (see README.MySQL)
     
     Umask                       000:000
     CreateHomeDir               yes
    将 #MySQLConfigFile               /etc/pureftpd-mysql.conf 改为
       MySQLConfigFile               /usr/local/pureftpd/etc/pureftpd-mysql.conf
       PureDB                        /usr/local/pureftpd/etc/pureftpd.pdb
---------------------------配置pureftpd-mysql.conf参数--------
# vi /usr/local/pureftpd/etc/pureftpd-mysql.conf
MYSQLServer     127.0.0.1
MYSQLPort       3306
MYSQLSocket     /tmp/mysql.sock
MYSQLUser       pureftpd
MYSQLPassword   password
MYSQLDatabase   pureftpd
MYSQLCrypt      cleartext
MYSQLGetPW      SELECT Password FROM users WHERE User="\L"
MYSQLGetUID     SELECT Uid FROM users WHERE User="\L"
MYSQLDefaultUID 2000
MYSQLGetGID     SELECT Gid FROM users WHERE User="\L"
MYSQLDefaultGID 2000
MYSQLGetDir     SELECT Dir FROM users WHERE User="\L"
MySQLGetQTAFS  SELECT QuotaFiles FROM users WHERE User="\L"
MySQLGetQTASZ  SELECT QuotaSize FROM users WHERE User="\L"
MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="\L"
MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="\L"
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L"
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L"
----------------pureftpd_php_manager 配置(可选)------------------
1.将pureftpd_php_manager.zip拷贝到/software中
# cd /software
# unzip -d /var/www/pureftpd_php_manager pureftpd_php_manager.zip
# cd /var/www/pureftpd_php_manager
# chmod 755 *
# chmod 755 gfx/*
# chmod 755 goodies/*  
# chmod 755 inc/*
# vi pureftp.config.php
2. 设置安全访问认证
# vi /etc/httpd/conf/httpd.conf
  修改httpd服务器的IP地址
    ServerName 172.17.18.55:80
  
加入下面的语句:
  Alias /pureftpd_php_manager  "/var/www/pureftpd_php_manager/"
   
    deny from all
    options NONE
    AllowOverride AuthConfig
    order deny,allow
   
# vi .htaccess
AuthType Basic
AuthUserFile /usr/local/pureftpd/etc/pureftpd_manager.passwd
AuthName pureftpd
require valid-user
satisfy any

增加管理用的用户ftpadmin
# useradd -g ftpgroup -d /dev/null -s /sbin/nologin ftpadmin -u 2001
# cd /usr/local/pureftpd/etc/
# htpasswd -bc pureftpd_manager.passwd ftpadmin password
# service httpd restart
#
IE 浏览器上输入
http://IP_ADRESS/pureftpd_php_manager/
用户:ftpadmin
密码:password

-----------------------------手动启动pureftpd----------------------------
#/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
#killall pure-ftpd
------------------------------系统自动启动pureftpd---------------------
# cp /software/pure-ftpd-1.0.21/contrib/redhat.init    /etc/init.d/pureftpd
# cd /etc/init.d
# chmod 755 pureftpd
# chkconfig --add pureftpd
# chkconfig pureftpd on 3 5
# vi pureftpd   
将 fullpath=/usr/local/sbin/$prog 改为:
    fullpath=/usr/local/pureftpd/sbin/$prog
将  pureftpwho=/usr/local/sbin/pure-ftpwho  改为:
   
    pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho
将 $fullpath /etc/pure-ftpd.conf --daemonize 改为:
   
   $fullpath /usr/local/pureftpd/etc/pure-ftpd.conf --daemonize
# ./pureftpd restart

------------------------------测试----------------
ftp 172.17.18.55
220---------- 欢迎来到 Pure-FTPd ----------
220-您是第 1 个使用者,最多可达 50 个连接
220-现在本地时间是 17:18。服务器端口: 21。
220-这部主机也欢迎IPv6的连接
220 在 15 分钟内没有活动,您被会断线。
User (172.17.18.55:(none)): test
331 使用者 test OK. 需要密码.
Password:(password)
230-使用者 test 有以下组的权限::  ftpgroup
230-OK. 目前限制的目录是 /
230 121805 Kbytes使用 (23%) - 授权可用: 512000 Kb


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/815/showart_347981.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP