基于FreeBSD5.4全能服务器安装
pureftpd-mysql.conf配置文件
###############################################################################
# #
# Sample Pure-FTPd Mysql configuration file. #
# See README.MySQL for explanations. #
# #
###############################################################################
# Optional : MySQL server name or IP. Dont define this for unix sockets.
#MYSQLServer 127.0.0.1
# Optional : MySQL port. Dont 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 /var/lib/mysql/mysql.sock
# Mandatory : user to bind the server as.
MYSQLUser pureftpd
# Mandatory : user password. You must have a password.
MYSQLPassword qKiscCbwbXAkWp.
# 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 leartext
MYSQLCrypt crypt
# 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
####################################建立ftp用户组##############################
pw groupadd ftpusers -g 2000
pw useradd ftp -u 2000 -g ftpusers -s /sbin/nologin
#################将以下代码保存成文本文件并命名成script.mysql####################
INSERT INTO mysql.user (Host, User, Password, Select_priv, Insert_priv,
Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv,
Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv,
Index_priv, Alter_priv) VALUES
(localhost,ftp,PASSWORD(password),Y,Y,Y,Y,N,N,N,N,
N,N,N,N,N,N);
FLUSH PRIVILEGES;
CREATE DATABASE ftpusers;
USE ftpusers;
CREATE TABLE admin (
Username varchar(35) NOT NULL default ,
Password char(32) binary NOT NULL default ,
PRIMARY KEY (Username)
) TYPE=MyISAM;
INSERT INTO admin VALUES (Administrator,MD5(password));
CREATE TABLE users (
User char(16) NOT NULL default ,
Password char(32) binary NOT NULL default ,
Uid int(11) NOT NULL default 2000,
Gid int(11) NOT NULL default 2000,
Dir char(128) NOT NULL default ,
QuotaFiles int(10) NOT NULL default 500,
QuotaSize int(10) NOT NULL default 30,
ULBandwidth int(10) NOT NULL default 80,
DLBandwidth int(10) NOT NULL default 80,
status enum(0,1) NOT NULL default 1,
ipaccess varchar(15) NOT NULL default *,
comment tinytext NOT NULL,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
INSERT INTO `users` VALUES (test1,MD5(123456),2001,2000,/home/test1,500,30,80,5,1,*,*);
##############################################################################################################################################################
#################################添加ftp用户数据库#############################
upload
script.mysql
mysql -u root -ppassword < script.mysql
#################################启动pure-ftpd##################################
/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
也可以通过
/usr/local/etc/rc.d/pure-ftpd.sh start
提示一下信息证明pure-ftpd已经工作
Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C8 -D -E -fftp -H -I15
-lmysql:/usr/local/etc/pureftpd-mysql.conf -L2000:8 -m4 -Q1:10 -s -U133:022
-u100 -Ow3c:/var/log/pureftpd.log -j -k99 -Z
#################################测试pureftp####################################
ftp 192.168.0.205
Connected to 192.168.0.205.
220---------- 欢迎来到 Pure-FTPd [TLS] ----------
220-您是第 1 个使用者,最多可达 50 个连接
220-现在本地时间是 13:17。服务器端口: 21。
220-这是私人系统 - 不开放匿名登录
220-这部主机也欢迎IPv6的连接
220 在 15 分钟内没有活动,您被会断线。
Name (192.168.0.205:chb):
输入用户名、密码
##################################设置ftp管理界面##############################
upload
chinaPHP_Manager
ee config.php
require language.php;
$LANG = $ZH_CN; //Language (Options are $DUTCH, $ENGLISH, $PT_BR, $RUSSIAN
//$SPANISH, $COREAN, $FRENCH, $HUNGARIAN, $GERMAN
// $TURKISH, $DANISH , $NORWEGIAN or $ZH_CN)
$LocationImages = "images"; // Location of images
$DBHost = "localhost"; // Ip-adres of MySQL server
// (Dont change this if you are using the default database)
$DBLogin = "ftp"; // Username of MySQL user
$DBPassword = "password"; // Password of MySQL user
$DBDatabase = "ftpusers"; // Name of database
$FTPaddress = "192.168.0.205:21"; // Domain name or ip-address of your ftp server
$DEFUserID = "2000"; // nobody // Default user id of virtual ftp user.
$DEFGroupID = "2000"; // guest // Default group is of virtual ftp user.
##############################设置ftp管理的虚拟主机############################
ee /usr/local/etc/apache/httpd.conf
添加
DocumentRoot "/home/chb/ftp"
ServerName www.chb.com
allow from all
Options +Indexes
###################################增加ftp启动项###############################
ee /etc/rc.conf
添加
pureftpd_enable="YES"












文章评论
共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面