- 论坛徽章:
- 0
|
FreeBSD全能服务器安装手册之文件服务器篇
--安装配置篇
cd /usr/ports/ftp/pure-ftpd
make WITH_WELCOMESG=yes WITH_UPLOADSCRIPT=yes WITH_COOKIE=yes \
WITH_VIRTUALHOSTS=yes WITH_VIRTUALROOT=yes WITH_DIRALIASES=yes \
WITH_QUOTAS=yes WITH_SYSQUOTAS=yes WITH_RATIOS=yes \
WITH_RATIOS=yes WITH_THROTTLING=yes \
WITH_MYSQL=1 WITH_LANG=simplified-chinese \
WITH_EVERYHING=yes WITH_PARANOIDMSG=yes \
WITH_VIRTUALCHROOT=yes WITH_TLS=yes \
WITH_LARGEFILE=yes
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Options for pure-ftpd 1.0.21 x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x[ ] LDAP Support for users in LDAP directories x x
x x[X] MYSQL Support for users in MySQL database x x
x x[X] PAM Support for PAM authentication x x
x x[ ] PGSQL Support for users in PostgreSQL database x x
x x[ ] PRIVSEP Enable privilege separation x x
x x[ ] PERUSERLIMITS Per-user concurrency limits x x
x x[X] THROTTLING Bandwidth throttling x x
x x[X] BANNER Show pure-ftpd welcome upon session start x x
x x[X] UPLOADSCRIPT Support uploadscript daemon x x
x x[ ] UTF8 Support for charset conversion (expreimental)x x
x x x x
x x x x
x x x x
x x x x
x x x x
tqmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjqu
x [ OK ] Cancel x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
make install
make clean
make rmconfig
cd /usr/local/etc
cp pureftpd-mysql.conf.sample pureftpd-mysql.conf
cp pure-ftpd.conf.sample pure-ftpd.conf
####################################建立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('passwd'),'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('passwd'));
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用户数据库#############################
mysql -u root -ppassword < script.mysql
###############################################################################
################################设置pureftpd-mysql.conf##########################
ee /usr/local/etc/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.
#选择:MySQL服务器的名字或IP地址。没有对unix 套接字作出详细定义
# MYSQLServer 127.0.0.1
#MYSQL服务器的 IP
# Optional : MySQL port. Don't define this if a local unix socket is used.
#选择:MySQL服务器对外服务的端口。如果本地UNIX端口已经被使用,则这个连接不能#被使用
# MYSQLPort 3306
#MYSQL 端口号
# Optional : define the location of mysql.sock if the server runs on this host.
MYSQLSocket /tmp/mysql.sock
#使用UNIX.sock本地连接
# Mandatory : user to bind the server as.
MYSQLUser root
#MYSQL中存放FTP用户的数据库的用户名
# Mandatory : user password. You must have a password.
MYSQLPassword rootpw
#MYSQL中存放FTP用户的数据库的密码
# Mandatory : database to open.
MYSQLDatabase pureftpd
#MYSQL中存放FTP用户的数据库的名字
# 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
#密码加密方式"cleartext", "crypt", "md5" and "password"
# cleartext 明文,crypt,md5,password是Backend password(‘your-passwd’)函数(MYSQL
#数据库所使用的password()函数)
# 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"
# 密码字段,我使用users表中的Password做为密码字段
# Query to execute in order to fetch the system user name or uid
MYSQLGetUID SELECT Uid FROM users WHERE User="\L"
#UID用户ID字段
# Optional : default UID - if set this overrides MYSQLGetUID
#MYSQLDefaultUID 1000
#默认的UID (注:如何开启该选项,MYSQLGetUID将失去作用)
# Query to execute in order to fetch the system user group or gid
MYSQLGetGID SELECT Gid FROM users WHERE User="\L"
#GID组ID字段
# Optional : default GID - if set this overrides MYSQLGetGID
#MYSQLDefaultGID 1000
#默认的GID (注:如何开启该选项,MYSQLGetGID将失去作用)
# Query to execute in order to fetch the home directory
MYSQLGetDir SELECT Dir FROM users WHERE User="\L"
#从数据库中获取FTP用户目录如/home/web/www-9812-net
# 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"
#磁盘限额,文件数限制。如1000,允许用户上传1千个文件
# 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"
#磁盘限额,FTP用户空间限制(单位为M),如:100M
# 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"
#上传/下载比率。MySQLGetRatioUL为上传比,MySQLGetRatioDL下载比。如:1:5
# 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"
#下传/下载带宽(单位KB/s)。MySQLGetBandwidthUL上传带宽,MySQLGetBandwidthDL3 |
|