pureftpd + mysql + web管理

pureftpd算是一套可完善管理使用者上/下傳的軟體,又可使用MYSQL認證開虛擬帳號方便又省事,不過之前用 ports 安裝好像都有問題,最後打算直接從網頁抓回來自己裝…..
所需環境:mysql3以上、apache、php
首頁:http://www.pureftpd.org/

1.安裝pure-ftpd
#fetch ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.20.tar.gz
#tar zxvf pure-ftpd-1.0.20.tar.gz
#cd cd pure-ftpd-1.0.20
#./configure
–prefix=/usr/local/pureftpd
–with-mysql
–with-shadow
–with-pam
–with-paranoidmsg
–with-welcomemsg
–with-uploadscript
–with-cookie
–with-virtualchroot
–with-virtualhosts
–with-virtualroot
–with-diraliases
–with-quotas
–with-sysquotas
–with-ratios
–with-ftpwho
–with-throttling
–with-language=traditional-chinese

#make ; make install
#cd configuration-file
#chmod u+x pure-config.pl
#cp pure-config.pl /usr/local/pureftpd/bin
#mkdir /usr/local/pureftpd/etc
#cp pure-ftpd.conf /usr/local/pureftpd/etc
#cd..;cp pureftpd* /usr/local/pureftpd/etc/
到這邊算是安裝好pure-ftpd。

2.修改pure-ftpd參數

#ee /usr/local/pureftpd/etc/pure-ftpd.conf
找出並修改以下這行,將前面#拿掉
MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf

# 限制每?用?到自己的根目?
ChrootEveryone yes

#ee /usr/local/pureftpd/pureftpd-mysql.conf
內容如下,請參照自己的mysql帳號密碼修改:
# MYSQLServer 127.0.0.1
# MYSQLPort 3306
MYSQLSocket /tmp/mysql.sock
MYSQLUser mysqluser
MYSQLPassword passwd
MYSQLDatabase pureftpd
MYSQLCrypt crypt
MYSQLGetPW SELECT Password FROM users WHERE User="L"
MYSQLGetUID SELECT Uid FROM users WHERE User="L"
MYSQLGetGID SELECT Gid FROM users WHERE User="L"
MYSQLGetDir SELECT Dir FROM users WHERE User="L"
MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="L"
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="L"
MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="L"
MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="L"
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="L"
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="L"

3.建立資料庫
mysql 中輸入以下sql指令。

CREATE DATABASE pureftpd;
CREATE TABLE `users` (
`id` int(32) unsigned NOT NULL auto_increment,
`User` varchar(16) NOT NULL default '',
`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 '',
`QuotaSize` smallint(5) NOT NULL default '0',
`QuotaFiles` int(11) NOT NULL default '0',
`ULBandwidth` smallint(5) NOT NULL default '0',
`DLBandwidth` smallint(5) NOT NULL default '0',
`ULRatio` smallint(6) NOT NULL default '0',
`DLRatio` smallint(6) NOT NULL default '0',
`comment` tinytext NOT NULL,
`ipaccess` varchar(15) NOT NULL default '*',
`status` enum('0','1') NOT NULL default '0',
`create_date` datetime NOT NULL default '0000-00-00 00:00:00',
`modify_date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`,`User`),
UNIQUE KEY `User` (`User`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;

4.抓取webftp管理介面
http://www.solariz.de/index.php?s=files&p= 中下載pureftpd_php_manager.zip

#mkdir /usr/local/www/data/pureftp ; cd /usr/local/www/data/pureftp
#fetch http://www.solariz.de/files/pureftpd_php_manager.zip
#unzip pureftpd_php_manager.zip
#ee pureftp.config.php
修改
$PUREFTP_CONFIG_FILE = '/usr/local/pureftpd/etc/pureftpd-mysql.conf'

根據pureftpd_php_manager又自行修改了一個線上申請FTP帳號的程式 範例網址 : http://segaa.net/ftp

5.啟動pure-ftpd
#/usr/local/pureftpd/bin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
#ftp 0
Connected to 0.
220———- 歡迎來到 Pure-FTPd ———-
220-您是第 1 個使用者,最多可達 50 個連線
220-現在本地時間是 19:05 。伺服器埠口: 21。
220-這部主機也歡迎IPv6的連線
220 在 15 分鐘內沒有活動,您被會斷線。
Name (0:segaa):


參考網址: http://www.cnfug.org/journal/3/06.html#_Toc44515439

分類未分類

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *