http://blog.chinaunix.net/u1/54035/showart_437951.html
http://www.chinaunix.net/jh/15/621909.html
http://freshmeat.net/projects/ppum/
Pure-ftpd + Mysql + Pureftpd_php_manager架设FTP
经历了大概三十多贴的讨论,终于把Pureftpd搞起来了,中心感谢CU的版主wlofg的耐心执着的解答,没有他没有今天帖子!
1 --------参考文档
http://www.freebsdchina.org/forum/viewtopic.php?t=20112&highlight=pureftp+%B0%B2%D7%B02005%B0%E6
http://bbs.chinaunix.net/forum/viewtopic.php?t=591054&show_type=
pureftpd-manger:参考 参考这两个以前的帖子
http://bbs.chinaunix.net/forum/viewtopic.php?t=552836&highlight=pureftpd
http://bbs.chinaunix.net/forum/viewtopic.php?t=552391&highlight=pureftpd
2 安装一下MySQL数据库。
cd /usr/ports/databases/mysql40-server
make SKIP_DNS_CHECK=yes BUILD_OPTIMIZED=yes BUILD_STATIC=yes install
其中﹕
SKIP_DNS_CHECK=yes 表示在加入本机名字时﹐不用做反向解析
BUILD_OPTIMIZED=yes 表示在编译时优化处理
BUILD_STATIC=yes 把mysqld编译成静态执行版本
这样子我们就完全了mysql的安装了﹐它自动会安装在/usr/local目录里面的﹐数据库目录位于/var/db/mysql,我得makefile文件部分参数设置:
CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
CONFIGURE_ARGS= --localstatedir=/var/db/mysql /
--without-debug /
--without-readline /
--without-libedit /
--without-bench /
--without-extra-tools /
--with-libwrap /
--with-mysqlfs /
--with-low-memory /
--with-comment='FreeBSD port: ${PKGNAME}' /
--enable-thread-safe-client
3 安装Pureftpd这个FTP SERVER的软件
cd /usr/ports/ftp/pure-ftpd
Pure-ftpd支持LDAP,PGSQL,MYSQL等多种认证方式﹐而我最喜欢的是和MySQL整合﹐使用MySQL来做用户身份验证﹐FTP根目录﹐上传下载速率等重要事务。因此﹐我们需要编译进mysql选项,我的makefile文件部分参数:
--prefix=/usr/local/pureftpd --with-mysql --with-paranoidmsg --with-shadow --with-welcomemsg --with-uploadscript --with-quotas --with-cookie --with-virtualhosts --with-virtualroot --with-diraliases --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-altlog --with-language=simplified-chinese
#make install clean
4 修改配置文件
cd /usr/local/etc
cp pureftpd-mysql.conf.sample pureftpd-mysql.conf
cp pure-ftpd.conf.sample pure-ftpd.conf
5 现在开始修改 pure-ftpd.conf 配置文件了﹐以便让这台SERVER可以更好的、稳定的运行起来﹐请按下面步骤
执行﹕ ee /usr/local/etc/pure-ftpd.conf
重点介绍需要注意的配置选项:
# Cage in every user in his home directory
ChrootEveryone yes # 限制所有用户在其主目录中
# MySQL configuration file (see README.MySQL)
MySQLConfigFile /usr/local/etc/pureftpd-mysql.conf # 打开mysql认证,文件路径一定不能错
# If you want simple Unix (/etc/passwd) authentication, uncomment this
UnixAuthentication yes # 同时开启了系统帐号的认证方式
# 请注意,LDAPConfigFile, MySQLConfigFile, PAMAuthentication 和#UnixAuthentication 这些指令只能被使用一次,不过,他们能被混合在一起用。例如:如果你使用了 MySQLConfigFile 和 UnixAuthentication,那么 SQL 服务器将被访问。如果因为用户名未找到而使 SQL 认证失败的话,就会在/etc/passwd 和 /etc/shadow 中尝试另外一种认证,如果因 为密码错误而使 SQL 认证失败的话,认证就会在此结束了。认证方式由它们被给出来的顺序而被链接了起来。
# Maximum bandwidth for *all* users (including anonymous) in KB/s
# Use AnonymousBandwidth *or* UserBandwidth, both makes no sense.
# UserBandwidth 8 #这里你可以对所有的用户进行带宽限制
其它选项可以参考http://www.chinaunix.net/jh/15/145846.html
6 ee /usr/local/etc/pureftpd-mysql.conf
打开一下的选项:
# Optional : MySQL server name or IP. Don't define this for unix sockets.
MYSQLServer 127.0.0.1
# Optional : MySQL port. Don't define this if a local unix socket is used.
MYSQLPort 3306
# Optional : define the location of mysql.sock if the server runs on this host.
MYSQLSocket /tmp/mysql.sock
# Mandatory : user to bind the server as.
MYSQLUser pureftpd ##允许访问Mysql中数据库的用户名
# Mandatory : user password. You must have a password.
MYSQLPassword 12345 ##允许访问Mysql中数据库的密码
# Mandatory : database to open.
MYSQLDatabase pureftpd ##允许访问Mysql中数据库的名称
# Mandatory : how passwords are stored
# Valid values are : "cleartext", "crypt", "md5" and "password"
# ("password" = MySQL password() function)
# You can also use "any" to try "crypt", "md5" *and* "password"
MYSQLCrypt cleartext ##密码认证方式
# Optional : bandwidth throttling.
# The server has to be compiled with throttling support.
# Values are in KB/s .
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="/L"
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="/L"
上面的选项很有用的,你可以对每一个用户单独配置上传下载的速度
7 在mysql中建立认证用户数据库
#mysql -u root -p
〉 DROP TABLE IF EXISTS users;
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;
注意这里的表格的名称一定要和pureftpd-mysql.conf中的sql语句的一致,否则会出现找不到表格的问题
需要给Mysql添加可以访问的用户权限,以下添加用户pureftpd,密码:12345
mysql>;grant all privileges on pureftpd.* to pureftpd@localhost identified by '12345';
给用户pureftpd 密码12345 操作表pureftpd.*的所有权利
mysql>;FLUSH PRIVILEGES;
重载受权表
8 安装PureFTPd Manager 2.50 下载地址http://bbs.chinaunix.net/forum/viewtopic.php?t=391165&show_type=new&sid=f3bb077481e0fefeb7c23d987e135b6d
把文件解压到/usr/local/www/data/pureftpd_php_manager下面,#ee pureftp.config.php
// Your exactly located mysql config file for pureftpd
$PUREFTP_CONFIG_FILE = '/usr/local/etc/pureftpd-mysql.conf';
// The location where all the Forms directed to. (Mayby no change needed
$SELF_URL = 'index.php';
// The location of your pure-ftpdwho binary (set this to chmod 4711)^
$FTP_WHO = "/usr/local/sbin/pure-ftpwho";
$DefaultGid = "2000"; # Default Group ID ( must be a real group acct )
$DefaultDir = "/home"; # Default User Dir ( use /./ at the end to chroot )
9 添加用户,组
添加FTP用户组 pw groupadd ftpusers –g 2000
添加FTP用户 pw useradd ftp -u 2000 -g ftpusers -s /sbin/nologin
10 起动:
/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
关闭:
killall pure-ftpd
11 添加用户 http://your server ip/pureftpd_php_manager/,就可以打开用户的管理界面,add usr 添加用户,其实就是修改mysql中库pureftpd/表us,但是这样是不安全的!如何利用apache的虚拟主机来实现安全认证:
加密pureftpd_php_manager目录
因为我们是放到网上执行的﹐所以你肯定不想每个人都跑去看你FTP用户吧﹗
我一般采用HTPASSWD验证﹐具体请这样子做﹐仍用我前面的例子﹕
我的pureftpd_php_manager目录位于 /usr/local/www/data/pureftpd_php_manager目录﹐我需要在apache的虚拟主机
/usr/local/etc/apache2/ #ee httpd.conf ,到最后一行
那一小节添加如下内容﹕
<directory "/usr/local/www/data/pureftpd_php_manager">;
deny from all
options NONE
allowoverride authconfig
order deny,allow
</directory>;
这样﹐若有人想进入该目录﹐必须通过apache验证﹐保证我们的安全(不是绝对安全)
/usr/local/www/data/pureftpd_php_manager目录﹐使用ee建立一个.htaccess的认证文件﹕
vi .htaccess
内容如下﹕
AuthType Basic
AuthUserFile /usr/local/etc/pureftpd_apache.passwd
AuthName pureftpd
require valid-user
satisfy any
存盘退出后﹐我们就可以使用htpasswd命令添加允许进入的该目录的用户了﹗
cd /usr/local/etc
进入该目录
htpasswd -bc pureftpd_apache.passwd ftp 123
这样将会在你的当前目录﹐创建一个pureftpd_apache.passwd的身份验证文件﹐用户名是ftp﹐密码是123﹐你可以改为你自己需要。
好了﹐看起来差不多了﹐麻烦你重新启动一下APACHE
#killall -HUP inetd
#[/usr/local/sbin]./apachectl restart
***************************结束*************************************
配置 pureftpd1.0.20问题总结:
1:http://192.168.30.2/pureftpd_php_manager/
提示:
Can't establish DB connection.
Access denied for user 'pureftpd'@'localhost' (using password: YES)
需要给Mysql添加可以访问的用户权限,以下添加用户pureftpd,密码:12345
mysql>;grant all privileges on pureftpd.* to pureftpd@localhost identified by '12345';
mysql>;FLUSH PRIVILEGES;
2 http://192.168.30.2/pureftpd_php_manager/
提示:
MySQL Error during Query !
[SELECT * FROM `users` ORDER BY User]
Table 'pureftpd.users' doesn't exist
/usr/local/etc/pureftpd-mysql-conf
需要的表格不存在或者名字不对!删除了原来的ftpd表,重新建立users表格,ie管理可以用了!
3 有一点还糊涂:pureftpd-mysql.conf中的
MYSQLUser pureftpd
# Mandatory : user password. You must have a password.
MYSQLPassword 12345
# Mandatory : database to open.
MYSQLDatabase pureftpd 这个数据库是不是应该填写mysql?
因为我感觉这是mysql访问权的设置?
mysql>;grant all privileges on pureftpd.* to pureftpd@localhostidentified by '12345';
mysql>;FLUSH PRIVILEGES;
很凑巧管理虚拟用户的数据库也叫pureftd,这两者有特殊关系吗?
你理解得不对,对于访问mysql数据库权限的认证,已经在编译的时候打包,不需要考虑
而文件pureftpd-mysql.conf中的设置:
MYSQLUser 指定连接mysql数据库的用户,你的是pureftpd
MYSQLPassword 指定密码
MYSQLDatabase 指定存放pureftpd用户数据库,你的数据库名是pureftpd
grant all privileges on pureftpd.* to pureftpd@localhost identified by '12345';
这个sql的意思是把数据库pureftpd的所有访问权限都开放给用户pureftpd
4 认证出错,为什么启动 /usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf则会有提示:Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -E -fftp -H -I10 -lmysql:/usr/local/etc/pureftpd-mysql.conf -L2000:8 -m4 -s -U133:022 -u100 -Ostats:/var/log/pureftpd.log -k99 -Z
421 未知的验证方法: mysql:/usr/local/etc/pureftpd-mysql.conf
我还是怀疑mysql支持没有编译到pureftpd里去,不然不会报这个的421 未知的验证方法: mysql
重新编译一下吧,不加那个--with-everything试试
make config----选择 mysql , PERUSERLIMITS ,THROTTLING, BANNER
make deinstall
make reinstall----重起服务器 开启 /usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
成功!不再出现421错误!
root@fw.com[/root] /usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -E -fftp -H -I10 -lmysql:/usr/local/etc/pureftpd-mysql.conf -L2000:8 -m4 -s -U133:022 -u100 -Ostats:/var/log/pureftpd.log -k99 -Z
ftp客户端:C:/Documents and Settings/Administrator.SERVER>;ftp 192.168.30.2
Connected to 192.168.30.2.
220---------- 欢迎来到 Pure-FTPd ----------
220-您是第 1 个使用者,最多可达 50 个连接
220-现在本地时间是 17:37。服务器端口: 21。
220-这是私人系统 - 不开放匿名登录
220 在 10 分钟内没有活动,您被会断线。
User (192.168.30.2:(none)):
***********************
5 # ee pure-ftp.conf
" # Cage in every user in his home directory
ChrootEveryone yes
TrustedGID 100
"
怎么用系统账号chy (adduser添加),不能现在/home/chy里面,chy可以访问
“/” ,什么原因?谢谢!
修改/etc/passwd里用户chy的主目录
由/home/chy
改为/home/chy/./
6
Q:用户不能验证,登陆时老是显示验证失败
A:你的pureftpd-mysql.conf里面的用户名字和密码,数据库的名称,字段的名称都对了么?一定要
保证都填对了!还有就是确认用户的主目录存在,并且有访问的权限,最后就是用户的状态是active
么?
7
Q:用户登陆的不能读写文件
A:确认用户对其主目录具有读写的权限
8
Q:quota不起作用
A:确保用户的.ftpquota文件权限正确
有关mysql认证的讨论,
race-man(37302964) 15:09:50
文件:/usr/local/etc/pureftpd-mysql.conf打开:
MYSQLUser pureftpd
MYSQLPassword abcdefg
# Mandatory : how passwords are stored
# Valid values are : "cleartext", "crypt", "md5" and "password"
# ("password" = MySQL password() function)
# You can also use "any" to try "crypt", "md5" *and* "password"
MYSQLCrypt cleartext
枕头(12811543) 15:02:42
MYSQLUser pureftpd
MYSQLPassword abcdefg
枕头(12811543) 15:02:47
这个很明显是错的
枕头(12811543) 15:02:55
你得在user表里边使用
枕头(12811543) 15:03:29
这个是连接mysql的认证,需要在user表里边加数据的
枕头(12811543) 15:03:47
而且不应该是cleartext了,得看你的mysql认证方式
枕头(12811543) 15:03:54
剩下的very出来放图
枕头(12811543) 15:03:55
完毕
very(49181322) 15:04:13
那个是pure访问mysql用的密码
grace-man(37302964)
15:12:56
哇靠!掉我得胃口!!!!!!!放狗!!!!咬
枕头(12811543) 15:31:35
在mysql里边加一个用户,用于pftp的验证
枕头(12811543) 15:31:52
然后在配置文件里边把它支持的认证方式都加进去
谢谢!枕头,我理解:用户访问ftp server,pftp连接mysql,需要通过mysql的认证许可。实现方式:在Mysql添加用户;
用户帐号的访问,还需要Mysql数据库的表格里面有相应的账号表格支持,我认为有2个认证在这个过程,对不对?
对了,第一次认证是pftp连接到mysql数据库,这个是数据库本身的认证;第二次认证是开了那张ftp的表,是ftp认证的过程,张微波的blog里边有详细的解说的
mysql>;create user purftpd@localhost identified by 'abcdefg';
grant all privileges on *.* to pureftpd@localhost identified by 'abcdefg'
##grant all privileges on 你刚建立的数据库名称.* to 你要建的mysql用户名称@localhost identified by 'mysql新用户密码'
怎么查看刚才建立的用户表?
use mysql
select User,Password,Host from user;
注意大小写
删除一条记录
delete from user where user = 'purftpd'
反安装Port删除配置文件
# make clean rmconfig
CUl论坛上 pureftpd+phpmanager2.5+mysql问题
Q:
参考文档:http://www.freebsdchina.org/forum/viewtopic.php?t=20112&highlight=pureftp+%B0%B2%D7%B02005%B0%E6
http://bbs.chinaunix.net/forum/viewtopic.php?t=591054&show_type=
l我的PUREFTPD manager 2.5,由ie浏览产生如下错误:
MySQL Error during Query !
[seLECT * FROM `users` ORDER BY User]
Table 'pureftpd.users' doesn't exist
怎么回事?我建立的访问mysql的用户帐号,(name)pureftpd:(pwd)12345
grant all privileges on pureftpd.* to pureftpd@localhost identified by '12345';
存在库mysql/user表中,怎么解决,谢谢!
而且在pureftpd-mysql.conf ,用户名,密码
A:
确定已经建了数据库pureftpd,并在库中建表users
能否写出当时操作的sql语句?
另外,给出pureftpd-mysql.conf的内容
Q;
多谢勤奋热心的版主!我想弄明白2个认证的问题:
1 pureftpd 服务器软件访问mysql数据库,需要认证吗?我认为需要
帐号保存在文件pureftpd-mysql.conf 中:
MYSQLUser pureftpd
MYSQLPassword 123456
MYSQLDatabase pureftpd
2 虚拟用户访问,需要认证,账号存在我自己建立的新的数据库pureftpd中
/表ftpd,建立他的sql语句如下:DROP TABLE IF EXISTS ftpd;
CREATE TABLE ftpd (
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;
3 附上:pureftpd-mysql.conf
# Optional : MySQL server name or IP. Don't define this for unix sockets.
# MYSQLServer 127.0.0.1
# Optional : MySQL port. Don't define this if a local unix socket is used.
# MYSQLPort 3306
# Optional : define the location of mysql.sock if the server runs on this host.
MYSQLSocket /tmp/mysql.sock
# Mandatory : user to bind the server as.
MYSQLUser pureftpd
# Mandatory : user password. You must have a password.
MYSQLPassword 12345
# Mandatory : database to open.
MYSQLDatabase pureftpd
# Mandatory : how passwords are stored
# Valid values are : "cleartext", "crypt", "md5" and "password"
# ("password" = MySQL password() function)
# You can also use "any" to try "crypt", "md5" *and* "password"
MYSQLCrypt cleartext
# In the following directives, parts of the strings are replaced at
# run-time before performing queries :
#
# /L is replaced by the login of the user trying to authenticate.
# /I is replaced by the IP address the user connected to.
# /P is replaced by the port number the user connected to.
# /R is replaced by the IP address the user connected from.
# /D is replaced by the remote IP address, as a long decimal number.
#
# Very complex queries can be performed using these substitution strings,
# especially for virtual hosting.
# Query to execute in order to fetch the password
MYSQLGetPW SELECT Password FROM users WHERE User="/L"
# Query to execute in order to fetch the system user name or uid
MYSQLGetUID SELECT Uid FROM users WHERE User="/L"
# Optional : default UID - if set this overrides MYSQLGetUID
#MYSQLDefaultUID 1000
# Query to execute in order to fetch the system user group or gid
MYSQLGetGID SELECT Gid FROM users WHERE User="/L"
# Optional : default GID - if set this overrides MYSQLGetGID
#MYSQLDefaultGID 1000
# Query to execute in order to fetch the home directory
MYSQLGetDir SELECT Dir FROM users WHERE User="/L"
# Optional : query to get the maximal number of files
# Pure-FTPd must have been compiled with virtual quotas support.
# MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="/L"
# Optional : query to get the maximal disk usage (virtual quotas)
# The number should be in Megabytes.
# Pure-FTPd must have been compiled with virtual quotas support.
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="/L"
# Optional : ratios. The server has to be compiled with ratio support.
# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="/L"
# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="/L"
# Optional : bandwidth throttling.
# The server has to be compiled with throttling support.
# Values are in KB/s .
# MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="/L"
# MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="/L"
# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
# 1) You know what you are doing.
# 2) Real and virtual users match.
# MySQLForceTildeExpansion 1
# If you upgraded your tables to transactionnal tables (Gemini,
# BerkeleyDB, Innobase...), you can enable SQL transactions to
# avoid races. Leave this commented if you are using the
# traditionnal MyIsam databases or old (< 3.23.x) MySQL versions.
# MySQLTransactions On
辛苦版主了!叩谢先!
A:
1. 正确
2, 3. 你的存放用户的表是ftpd
应修改pureftpd-mysql.conf 中所有select ... from users
把users改成你的表ftpd
Q:
谢版主,我删除了原来的ftpd表,重新建立users表格,ie管理可以用了!有一点还糊涂:pureftpd-mysql.conf中的
MYSQLUser pureftpd
# Mandatory : user password. You must have a password.
MYSQLPassword 12345
# Mandatory : database to open.
MYSQLDatabase pureftpd 这个数据库是不是应该填写mysql?
因为我感觉这是mysql访问权的设置?
mysql>;grant all privileges on pureftpd.* to pureftpd@localhostidentified by '12345';
mysql>;FLUSH PRIVILEGES;
很凑巧管理虚拟用户的数据库也叫pureftd,这两者有特殊关系吗?
A:
你理解得不对
pureftpd-mysql.conf中的设置
MYSQLUser 指定连接mysql数据库的用户,你的是pureftpd
MYSQLPassword 指定密码
MYSQLDatabase 指定存放pureftpd用户数据库,你的数据库名是pureftpd
grant all privileges on pureftpd.* to pureftpd@localhost identified by '12345';
这个sql的意思是把数据库pureftpd的所有访问权限都开放给用户pureftpd
Q:多谢版主,启动的时候怎么认证出问题!
root@fw.com[/usr/local/sbin]pure-config.pl ../etc/pure-ftpd.conf
Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -E -fftp -H -I10 -lmysql:/usr/local/etc/pureftpd-mysql.conf -lpuredb:/usr/local/etc/pureftpd.pdb -lunix -L2000:8 -m4 -s -U133:022 -u100 -Ostats:/var/log/pureftpd.log -k99 -Z
421 未知的验证方法: mysql:/usr/local/etc/pureftpd-mysql.conf
**********-O stats:/var/log/pureftpd.log----系统没有这个文件阿?还发现一个怪问题,修改了配置文件pure-ftpd.conf 空闲时间15--〉10,则么下一次启动还是提示15分钟空闲,让人感觉配置文件没起作用,似不是还要回到ports下在 make install 一下子才起作用?
A:
usr/local/etc/pure-ftpd.conf的内容?
/var/log/pureftpd.log这个文件没有生成吗?
编译时加入mysql支持了吧?
Q:
CONFIGURE_ARGS= --with-everything /
--with-paranoidmsg /
--with-virtualchroot /
--with-tls /
--with-largefile /
--with-puredb /
--with-throttling /
--with-mysql /
--with-quotas /
--sysconfdir=${PREFIX}/etc
A:log文件有生成吗?配置文件里怎么有3个Altlog
现在什么错误?
Q:
CONFIGURE_ARGS= --with-everything /
--with-paranoidmsg /
--with-virtualchroot /
--with-tls /
--with-largefile /
--with-puredb /
--with-throttling /
--with-mysql /
--with-quotas /
--sysconfdir=${PREFIX}/etc
Q:
log文件没有生成!
因为想生成Log文件。不懂含义所以。都打开了,所以配置文件里怎么有3个Altlog
现在什么错误?还得421,pureftpd-mysql.conf认证出错,我在主配置文件取消了Mysql认证,就没有421错误了。上pureftpd-mysql.conf如下:
##############################################
# #
# Sample Pure-FTPd Mysql configuration file. #
# See README.MySQL for explanations. #
# #
##############################################
# Optional : MySQL server name or IP. Don't define this for unix sockets.
# MYSQLServer 127.0.0.1
# Optional : MySQL port. Don't define this if a local unix socket is used.
# MYSQLPort 3306
# Optional : define the location of mysql.sock if the server runs on this
host.
MYSQLSocket /tmp/mysql.sock
# Mandatory : user to bind the server as.
MYSQLUser pureftpd
# Mandatory : user password. You must have a password.
MYSQLPassword 12345
# Mandatory : database to open.
MYSQLDatabase pureftpd
# Mandatory : how passwords are stored
# Valid values are : "cleartext", "crypt", "md5" and "password"
# ("password" = MySQL password() function)
# You can also use "any" to try "crypt", "md5" *and* "password"
MYSQLCrypt cleartext
# In the following directives, parts of the strings are replaced at
# run-time before performing queries :
#
# /L is replaced by the login of the user trying to authenticate.
# /I is replaced by the IP address the user connected to.
# /P is replaced by the port number the user connected to.
# /R is replaced by the IP address the user connected from.
# /D is replaced by the remote IP address, as a long decimal number.
#
# Very complex queries can be performed using these substitution strings,
# especially for virtual hosting.
# Query to execute in order to fetch the password
MYSQLGetPW SELECT Password FROM users WHERE User="/L"
# Query to execute in order to fetch the system user name or uid
MYSQLGetUID SELECT Uid FROM users WHERE User="/L"
# Optional : default UID - if set this overrides MYSQLGetUID
#MYSQLDefaultUID 1000
# Query to execute in order to fetch the system user group or gid
MYSQLGetGID SELECT Gid FROM users WHERE User="/L"
# Optional : default GID - if set this overrides MYSQLGetGID
#MYSQLDefaultGID 1000
# Query to execute in order to fetch the home directory
MYSQLGetDir SELECT Dir FROM users WHERE User="/L"
# Optional : query to get the maximal number of files
# Pure-FTPd must have been compiled with virtual quotas support.
# MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="/L"
# Optional : query to get the maximal disk usage (virtual quotas)
# The number should be in Megabytes.
# Pure-FTPd must have been compiled with virtual quotas support.
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="/L"
# Optional : ratios. The server has to be compiled with ratio support.
# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="/L"
# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="/L"
# Optional : bandwidth throttling.
# The server has to be compiled with throttling support.
# Values are in KB/s .
# MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="/L"
# MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="/L"
# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
# 1) You know what you are doing.
# 2) Real and virtual users match.
# MySQLForceTildeExpansion 1
# If you upgraded your tables to transactionnal tables (Gemini,
# BerkeleyDB, Innobase...), you can enable SQL transactions to
# avoid races. Leave this commented if you are using the
# traditionnal MyIsam databases or old (< 3.23.x) MySQL versions.
# MySQLTransactions On
!仅仅保留mysql认证
!!mysql配置文件
MYSQLCrypt cleartext 换成md5 crypt password
都不行,421错误
!!!在编译添加--with-altlog ,make install 在试试,吃饭吧版主!
迷惑的问题:怎么已经修改了pure-ftpd.conf的默认空闲时间为10分钟,重起服务器,怎么欢迎信息还是现实的默认值15分钟?
A:
改成1分钟,然后让ftp空闲1分钟,看什么情况?
设置欢迎信息文件了吗?如果有,什么内容?
Q:
因为是用系统账号登陆的,useradd添加的,空闲5分钟了也没有断线,我真的傻了
A:
你用什么客户端?ftp工具一般都有防超时的功能,不断地发送noop命令
Q:
谢谢执着的wolfg版主!
还是15分钟的空闲,然后断线,为了防止不断noop,我直接用dos下ftp,难道控制空闲的还有其他文件,莫名!
A:
启动pureftpd的命令会在shell里输出一行启动使用了哪些参数,把那行内容发上来我看看
Q:
版主:我找的帖子,个别地方不理解,看看能不能解决?
Q:用户不能验证,登陆时老是显示验证失败
A:你的pureftpd-mysql.conf里面的用户名字和密码,数据库的名称,字段的名称都对了么?一定要保证都填对了!
(pureftpd,12345 ,pureftpd---没问题)
还有就是确认用户的主目录存在,并且有访问的权限,最后就是用户的状态是active -----这里不懂,虚拟用户还需要在home下给他建立目录吗?如果需要,怎么建立?多谢!
A:
虚拟用户都是映射到同一个系统用户上的,一般是ftp,所以这个系统用户一定要有主目录
Q:
方法一:
root@fw.com[/root]/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -E -fftp -H -I10 -lmysql:/usr/local/etc/pureftpd-mysql.conf -lunix -L2000:8 -m4 -s -U133:022 -u100 -Ostats:/var/log/pureftpd.log -k99 -Z
421 未知的验证方法: mysql:/usr/local/etc/pureftpd-mysql.conf
方法二:
root@fw.com[/usr/local/etc/rc.d]./pure-ftpd.sh start
root@fw.com[/usr/local/etc/rc.d]./pure-ftpd.sh status
root@fw.com[/usr/local/etc/rc.d]./pure-ftpd.sh stop
但是好像没起来,而且ftp 192.168.30.2 提示:>; ftp: connect :连接被拒绝
服务器没起来,没有在/etc/rc.d 写自启动文件,/etc/inetd也没有写enable
A:
pureftpd -l 什么结果?
Q:
pureftpd -l-----小弟不知道这个命令怎么运行的?接受fb54才1 weeks
A:
在shell下,到pureftpd所在的目录,执行
./pureftpd -l
注意,是小写的L,不是1
Q:
root@fw.com[/usr/local/sbin]./pure-ftpd -l ftp
421 未知的验证方法: ftp
root@fw.com[/usr/local/sbin]./pure-ftpd -l v1
421 未知的验证方法: v1
root@fw.com[/usr/local/sbin]./pure-ftpd -l root
421 未知的验证方法: root
root@fw.com[/usr/local/sbin]
版主太客气了!为什么以root@fw.com[/usr/local/etc/rc.d]./pure-ftpd.sh start 没有错误提示?
而/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf则会有提示:Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -E -fftp -H -I10 -lmysql:/usr/local/etc/pureftpd-mysql.conf -L2000:8 -m4 -s -U133:022 -u100 -Ostats:/var/log/pureftpd.log -k99 -Z
421 未知的验证方法: mysql:/usr/local/etc/pureftpd-mysql.conf
A:
我还是怀疑mysql支持没有编译到pureftpd里去,不然不会报这个的421 未知的验证方法: mysql
重新编译一下吧,不加那个--with-everything试试
Q:
#make deinstall
# ee makefile :--prefix=/usr/local/pureftpd --with-mysql --with-paranoidmsg --with-shadow --with-welcomemsg --with-uploadscript --with-quotas --with-cookie --with-virtualhosts --with-virtualroot --with-diraliases --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-altlog --with-language=simplified-chinese
# make install
奇怪!上面的重新安装并没有解决问题!但是小弟尝试
make config----选择 mysql , PERUSERLIMITS ,THROTTLING, BANNER
make deinstall
make reinstall----开启 /usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
成功!不再出现421错误,看来版主的思路是对的!可是怎么必须 make config,我得makefile文件的参数还是上面的阿!
root@fw.com[/root]/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -E -fftp -H -I10 -lmysql:/usr/local/etc/pureftpd-mysql.conf -L2000:8 -m4 -s -U133:022 -u100 -Ostats:/var/log/pureftpd.log -k99 -Z
A:
BSD?
你是从port安装吗?我对BSD不是很熟,呵呵
超时的设置也好了吗?
Q:
小弟用fb5.4 ,对,开机logo显示的时间调整成了10分钟,从port安装的。
怎么建立虚拟用户,我是通过PureFTPd Manager 2.50 ,ie管理界面还添加用户的,现在问题是添加的用户,登陆530错误,但是Mysql 的pureftpd数据库users表,有用户的信息存在,感觉离成功一步之遥了,加
A:
pureftpd-mysql.conf里密码认证方式设置的是什么?
cleartext or md5?
Q:
MYSQLCrypt password
等我完全调好,我会上贴子到论坛,以报版主和论坛的热心
A:
比较一下数据库里的密码字段
比如设的密码是123456
select password('123456');
看这个结果跟用pureftpd manager插入记录加密后的密码
的密码一样不一样
Q:
打开数据库:
mysql>; select * from users;
+------+--------+----------+------+------+----------+-------------+-------------+---------+----------+-----------+------------+
| User | status | Password | Uid | Gid | Dir | ULBandwidth | DLBandwidth | comment | ipaccess | QuotaSize | QuotaFiles |
+------+--------+----------+------+------+----------+-------------+-------------+---------+----------+-----------+------------+
| test | 1 | 12345 | 3000 | 3000 | /usr/www | 0 | 0 | | * | 50 | 0 |
+------+--------+----------+------+------+----------+-------------+-------------+---------+----------+-----------+------------+
1 row in set (0.00 sec)
密码:12345
ee Pureftpd-mysql.conf
MYSQLPassword 12345
客户端登陆的时候,输入密码,屏幕闪了一下子,感觉系统还是分时间片来进行认证的
,还是等不上去,但是系统用户可以正常登陆!
A:
我不是这个意思。
你不是说用pureftpd manager加的用户不能登录ftp吗?
所以,我想让你检查用manager加的用户,在数据库里的密码(加密以后的,你用的是password方式),和直接用sql语句产生的密码是否一致
Q:
你不是说用pureftpd manager加的用户不能登录ftp吗?--是的!
mysql>; select password('123456');
+-------------------------------------------+
| password('123456') |
+-------------------------------------------+
| *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-------------------------------------------+
1 row in set (0.00 sec)
manager加的用户,在数据库里pureftpd (users表)的密码:
mysql>; select * from users;
+------+--------+----------+------+------+----------+-------------+-------------+---------+----------+-----------+------------+
| User | status | Password | Uid | Gid | Dir | ULBandwidth | DLBandwidth | comment | ipaccess | QuotaSize | QuotaFiles |
+------+--------+----------+------+------+----------+-------------+-------------+---------+----------+-----------+------------+
| test | 1 | 12345 | 3000 | 3000 | /usr/www | 0 | 0 | | * | 50 | 0 |
+------+--------+----------+------+------+----------+-------------+-------------+---------+----------+-----------+------------+
1 row in set (0.00 sec)
密码:12345
A:
存到数据库里是明码的密码
把MYSQLCrypt password 改成MYSQLCrypt cleantext
一定就可以登录了
这是pureftpd_manager的问题,它没有安装你指定的加密方式存放密码
参考这两个以前的帖子
http://bbs.chinaunix.net/forum/viewtopic.php?t=552836&highlight=pureftpd
http://bbs.chinaunix.net/forum/viewtopic.php?t=552391&highlight=pureftpd
Q:
Connected to 192.168.30.2.
220---------- 欢迎来到 Pure-FTPd ----------
220-您是第 1 个使用者,最多可达 50 个连接
220-现在本地时间是 11:50。服务器端口: 21。
220-这是私人系统 - 不开放匿名登录
220 在 15 分钟内没有活动,您被会断线。
User (192.168.30.2:(none)): test
331 使用者 test OK. 需要密码.
Password:
421 没有家目录 - 取消
Connection closed by remote host.
***********************************
改成了cleartext ,版主建议是对的!
test是我建立的虚拟用户,怎么要家目录?怎么修改?
A:用户没有home directory
Q:
我建立了 /home/test ,终于:
Connected to 192.168.30.2.
220---------- 欢迎来到 Pure-FTPd ---------
220-您是第 1 个使用者,最多可达 50 个连接
220-现在本地时间是 12:00。服务器端口: 21。
220-这是私人系统 - 不开放匿名登录
220 在 15 分钟内没有活动,您被会断线。
User (192.168.30.2:(none)): test
331 使用者 test OK. 需要密码.
Password:
230-使用者 test 有以下组的权限:: 3000
230 OK. 目前限制的目录是 /
终于搞好了,辛苦了版主3,4天,小弟叩谢了!在调调,着手准备读书笔记。。。
发觉一个奇怪的现象,:
http://www.slackware.org.tw/?q=node/view/73
Conco的Pureftp+Mysql+Maneage文章中提到的:
“再建立ftpuser使用者與群組”
而之后的配置中都没用到该“ftpuser使用者”!
也就是说建立与不建立该“ftpuser使用者”都是可以的,对么?
不建立可能会更安全些,是这样的么?!
“再建立ftpuser使用者與群組”---究竟有什么用的呢?!
谢谢!:)
以后你可以使用ftpusers用户去管理虚拟用户的文件,而不必用root用户去管理
附上﹕自启动的pureftpd.sh
#!/bin/sh
if ! PREFIX=$(expr $0 : "/(/.*/)/etc/rc/.d/$(basename $0)/$"); then
echo "$0: Cannot determine the PREFIX" >;&2
exit 1
fi
case "$1" in
start)
[ -r ${PREFIX}/etc/pure-ftpd.conf ] && /
${PREFIX}/sbin/pure-config.pl ${PREFIX}/etc/pure-ftpd.conf >; /dev/null && /
echo -n ' pure-ftp'
;;
stop)
[ -r /var/run/pure-ftpd.pid ] && /
kill `cat /var/run/pure-ftpd.pid` >; /dev/null && /
echo -n ' pure-ftp'
;;
*)
echo "Usage: `basename $0` {start|stop}" >;&2
;;
esac
exit 0
2004/02/23