- 論壇徽章:
- 0
|
FreeBSD全能服務(wù)器安裝手冊(cè)之文件服務(wù)器篇
--安裝配置篇
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用戶(hù)組##############################
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用戶(hù)數(shù)據(jù)庫(kù)#############################
mysql -u root -ppassword < script.mysql
###############################################################################
################################設(shè)置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服務(wù)器的名字或IP地址。沒(méi)有對(duì)unix 套接字作出詳細(xì)定義
# MYSQLServer 127.0.0.1
#MYSQL服務(wù)器的 IP
# Optional : MySQL port. Don't define this if a local unix socket is used.
#選擇:MySQL服務(wù)器對(duì)外服務(wù)的端口。如果本地UNIX端口已經(jīng)被使用,則這個(gè)連接不能#被使用
# MYSQLPort 3306
#MYSQL 端口號(hào)
# 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用戶(hù)的數(shù)據(jù)庫(kù)的用戶(hù)名
# Mandatory : user password. You must have a password.
MYSQLPassword rootpw
#MYSQL中存放FTP用戶(hù)的數(shù)據(jù)庫(kù)的密碼
# Mandatory : database to open.
MYSQLDatabase pureftpd
#MYSQL中存放FTP用戶(hù)的數(shù)據(jù)庫(kù)的名字
# 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’)函數(shù)(MYSQL
#數(shù)據(jù)庫(kù)所使用的password()函數(shù))
# 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用戶(hù)ID字段
# Optional : default UID - if set this overrides MYSQLGetUID
#MYSQLDefaultUID 1000
#默認(rèn)的UID (注:如何開(kāi)啟該選項(xiàng),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
#默認(rèn)的GID (注:如何開(kāi)啟該選項(xiàng),MYSQLGetGID將失去作用)
# Query to execute in order to fetch the home directory
MYSQLGetDir SELECT Dir FROM users WHERE User="\L"
#從數(shù)據(jù)庫(kù)中獲取FTP用戶(hù)目錄如/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"
#磁盤(pán)限額,文件數(shù)限制。如1000,允許用戶(hù)上傳1千個(gè)文件
# 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"
#磁盤(pán)限額,F(xiàn)TP用戶(hù)空間限制(單位為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 |
|