Pure-FTPd 是一款免费(BSD)的,安全的,高质量和符合标准的FTP服务器。 侧重于运行效率和易用性。 它提供了简单的答案,他满足了大众化的需求,包括普通用户以及主机供应商们。
=安装pureftpd=
由于pureftpd不存在于CentOS中yum的官方库中,所以用yum安装pureftpd需要定义非官方的库
wget http://mirrors.ustc.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm
”’yum安装apache、pureftpd、mysq l”’
[root@localhost ~]# yum -y install httpd httpd-devel php phpmyadmin php-posix
[root@localhost~]# yum -y install pure-ftpd mysql-server
”’添加ftp用户组(ftpgroup)和用户名(ftpuser),为所有虚拟ftp用户映射。可以自己定义ftp用户组和用户名,还有空闲的用户id2001。”’
[root@localhost ~]# groupadd -g 2001 pureftp
[root@localhost ~]# useradd -u 2001 -s /sbin/nologin -g pureftp pureftp
”’编辑 /etc/pure-ftpd/pure-ftpd.conf 主配置文件”’
[root@localhost ~]# vim /etc/pure-ftpd/pure-ftpd.conf
修改116 # MySQLConfigFile /etc/pure-ftpd/pureftpd-mysql.conf 将其# 去掉
修改343 “ #CreateHomeDir yes ” 将其# 去掉
”’配置 php.ini”’
[root@localhost ~]# vim /etc/php.ini
short_open_tag = On 修改为On
”’数据库操作”’
[root@localhost extra]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Allrights reserved.
Oracle is a registered trademark of Oracle Corporationand/or its
affiliates. Other names may be trademarks of theirrespective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear thecurrent input statement.
mysql> CREATEDATABASE ftpusers;
Query OK, 1 row affected (0.00 sec)
mysql> USE ftpusers;
Database changed
mysql> CREATE TABLE admin (
-> Username varchar(35) NOT NULL default ”,
-> Password char(32) binary NOT NULL default”,
-> PRIMARY KEY (Username)
-> )TYPE=MyISAM;
Query OK, 0 rows affected, 1 warning (0.07 sec)
mysql> INSERT INTO admin VALUES (‘Administrator’,MD5(‘tmppasswd’));
Query OK, 1 row affected (0.00 sec)
mysql> CREATE TABLE users
(
-> User
varchar(16) NOT NULL default ”,
-> Password
varchar(32) binary NOT NULLdefault ”,
-> Uid
int(11) NOT NULL default ‘14’,
-> Gid
int(11) NOT NULL default ‘5’,
-> Dir
varchar(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’,
-> Ipaddress
varchar(15) NOT NULL default’*’,
-> Comment
tinytext,
-> Status
enum(‘0’,’1’) NOT NULL default ‘1’,
-> ULRatio
smallint(5) NOT NULL default ‘1’,
-> DLRatio
smallint(5) NOT NULL default ‘1’,
-> PRIMARY KEY (User
),
-> UNIQUE KEY User
(User
)
-> )TYPE=MyISAM;
Query OK, 0 rows affected, 1 warning (0.05 sec)
mysql> INSERT INTO ftpusers.users VALUES (‘archermind’,MD5(‘archermind’),65534,31, ‘/usr’, 100, 50, 75, 75, ‘*’, ‘Ftp user (for example)’, ‘1’, 0, 0);
Query OK, 1 row affected (0.00 sec)
==== ”’编辑 /etc/pure-ftpd/pureftpd-mysql.conf,将文本修改为如下”’ ====
[root@localhost ~]# vim /etc/pure-ftpd/pureftpd-mysql.conf
############################################################################
# #
# PureFTPd MySQLconfiguration file. #
# Generated by theinstallation wizard for the ‘User manager for PureFTPd’ #
# Seehttp://machiel.generaal.net for more info #
# or read theREADME.MySQL for explanations of the syntax. #
# #
############################################################################
# Optional : MySQL servername 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 thelocation of mysql.sock if the server runs on this host.
MYSQLSocket /tmp/mysql.sock
# Mandatory : user tobind the server as.
MYSQLUser root
# Mandatory : userpassword. You must have a password.
MYSQLPassword archermind
# Mandatory : database toopen.
MYSQLDatabase ftpusers
# Mandatory : howpasswords 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 md5
# In the followingdirectives, parts of the strings are replaced at
# run-time beforeperforming queries :
#
# \L is replaced by thelogin of the user trying to authenticate.
# \I is replaced by theIP address the user connected to.
# \P is replaced by theport number the user connected to.
# \R is replaced by theIP address the user connected from.
# \D is replaced by theremote IP address, as a long decimal number.
#
# Very complex queriescan be performed using these substitution strings,
# especially for virtualhosting.
# Query to execute inorder to fetch the password
MYSQLGetPW SELECT Password FROM users WHEREUser=”\L” AND Status=”1” AND (Ipaddress = “*” ORIpaddress LIKE “\R”)
# Query to execute inorder to fetch the system user name or uid
MYSQLGetUID SELECT Uid FROM users WHEREUser=”\L” AND Status=”1” AND (Ipaddress = “*” ORIpaddress LIKE “\R”)
# Optional : default UID- if set this overrides MYSQLGetUID
#MYSQLDefaultUID 1000
# Query to execute inorder to fetch the system user group or gid
MYSQLGetGID SELECT Gid FROM users WHEREUser=”\L” AND Status=”1” AND (Ipaddress = “*” ORIpaddress LIKE “\R”)
# Optional : default GID- if set this overrides MYSQLGetGID
#MYSQLDefaultGID 1000
# Query to execute inorder to fetch the home directory
MYSQLGetDir SELECT Dir FROM users WHEREUser=”\L” AND Status=”1” AND (Ipaddress = “*” ORIpaddress LIKE “\R”)
# Optional : query to getthe maximal number of files
# Pure-FTPd must havebeen compiled with virtual quotas support.
# MySQLGetQTAFS SELECT QuotaFiles FROM users WHEREUser=”\L”
# Optional : query to getthe maximal disk usage (virtual quotas)
# The number should be inMegabytes.
# Pure-FTPd must havebeen compiled with virtual quotas support.
# MySQLGetQTASZ SELECT QuotaSize FROM users WHEREUser=”\L”
# Optional : ratios. Theserver has to be compiled with ratio support.
# MySQLGetRatioUL SELECTULRatio FROM users WHERE User=”\L”
# MySQLGetRatioDL SELECTDLRatio FROM users WHERE User=”\L”
# Optional : bandwidththrottling.
# The server has to becompiled with throttling support.
# Values are in KB/s .
MySQLGetBandwidthUL SELECTULBandwidth FROM users WHERE User=”\L” AND Status=”1” AND(Ipaddress = “*” OR Ipaddress LIKE “\R”)
MySQLGetBandwidthDL SELECTDLBandwidth FROM users WHERE User=”\L” AND Status=”1” AND(Ipaddress = “*” OR Ipaddress LIKE “\R”)
# Enable ~ expansion.NEVER ENABLE THIS BLINDLY UNLESS :
# 1) You know what youare doing.
# 2) Real and virtualusers match.
# MySQLForceTildeExpansion1
# If you upgraded yourtables to transactionnal tables (Gemini,
# BerkeleyDB,Innobase…), you can enable SQL transactions to
# avoid races. Leave thiscommented if you are using the
# traditionnal MyIsamdatabases or old (< 3.23.x) MySQL versions.
# MySQLTransactions On
附:网站程序下载如下
[[File:WKioL1OioiPwuaEaAAJMkqZlicU822.zip|左|FTP 网页程序]]