這篇文章主要介紹Pureftpd和MySQL如何架設(shè)FTP服務(wù)器,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都做網(wǎng)站、網(wǎng)站制作、岳普湖網(wǎng)絡(luò)推廣、微信小程序開發(fā)、岳普湖網(wǎng)絡(luò)營銷、岳普湖企業(yè)策劃、岳普湖品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供岳普湖建站搭建服務(wù),24小時服務(wù)熱線:13518219792,官方網(wǎng)址:www.cdcxhl.com
下載mysql5.1.31 rpm文件和pure-ftpd源碼包
安裝mysql5.1.31共享包
rpm -ivh MySQL-shared-community-5.1.31-0.rhel5.i386.rpm
編譯安裝pure-ftpd
#./configure –prefix=/usr/local/pureftpd –with-mysql –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 #make #make check #make install
配置pure-ftpd
#cd configuration-file #chmod u+x pure-config.pl #cp pure-config.pl /usr/local/sbin/ #cp pure-ftpd.conf /usr/local/etc/ vi /usr/local/etc/pure-ftpd.conf
確認(rèn)以下三項
ChrootEveryone yes
MySQLConfigFile /etc/pureftpd-mysql.conf
CreateHomeDir yes
為puer-ftpd創(chuàng)建mysql數(shù)據(jù)庫和用戶
CREATE DATABASE pureftpd;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO ‘pureftpd’@'localhost’ IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES;
USE pureftpd;
CREATE TABLE ftpd (
User varchar(16) NOT NULL default ”,
status enum(’0′,’1′) NOT NULL default ’0′,
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 ”,
ULBandwidth smallint(5) NOT NULL default ’0′,
DLBandwidth smallint(5) NOT NULL default ’0′,
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default ‘*’,
QuotaSize smallint(5) NOT NULL default ’0′,
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
配置pureftpd-mysql.conf
vi /etc/pureftpd-mysql.conf
錄入
MYSQLSocket /tmp/mysql.sock
#MYSQLServer localhost
#MYSQLPort 3306
MYSQLUser pureftpd
MYSQLPassword password
MYSQLDatabase pureftpd
#MYSQLCrypt md5, cleartext, crypt() or password() – md5 is VERY RECOMMENDABLE uppon cleartext
MYSQLCrypt md5
MYSQLGetPW SELECT Password FROM ftpd WHERE User=”L” AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
MYSQLGetUID SELECT Uid FROM ftpd WHERE User=”L” AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
MYSQLGetGID SELECT Gid FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
MYSQLGetDir SELECT Dir FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User=”L”AND status=”1″ AND (ipaccess = “*” OR ipaccess LIKE “R”)
各參數(shù)注釋
User:用戶名
status:狀態(tài) 1為激活狀態(tài) 0為非激活狀態(tài)
Password :密碼
Uid:用戶系統(tǒng)ID號
GID:用戶組ID號
ULBandwidth :上傳***帶寬 單位 KB/S
DLBandwidth:下載***帶寬 單位 KB/S
comment :注釋
ipaccess :允許訪問IP地址
QuotaSize :磁盤配額總大小 單位MB
QuotaFiles :允許存放的文件數(shù)目個數(shù) 0為不限制
關(guān)掉進(jìn)程
killall pure-ftpd
啟動服務(wù)
/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
為ftp添加用戶
USE pureftpd;
INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`, `ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`, `QuotaFiles`) VALUES (‘test’, ’1′, MD5(‘test’), ’60031′, ’60031′, ‘/home/test’, ’128′, ’56′, ”, ‘*’, ’100′, ’0′);
即可用數(shù)據(jù)庫里的用戶和密碼登陸ftp
將pureftpd加載為系統(tǒng)服務(wù)
vi /etc/init.d/pureftpd
錄入
#!/bin/bash # chkconfig: 35 95 1 # description: script to start/stop pureftpd
case $1 in
start)
/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
;;
stop)
killall pure-ftpd
;;
*)
echo “Usage: $0 (start|stop)”
;;
esac
更改權(quán)限
# chmod 775 pureftpd
加入自動啟動
# chkconfig –add pureftpd
查看自動啟動設(shè)置
# chkconfig –list pureftpd
pureftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
以后可以用以下命令啟動和停止腳本
# service pureftpd start 啟動
# service pureftpd stop 停止
啟動和停止mysql服務(wù)
#service mysql start
#service mysql stop
若無法上傳文件,設(shè)置ftp文件夾權(quán)限
chmod -R 777 /data0/htdocs
以上是“Pureftpd和mysql如何架設(shè)FTP服務(wù)器”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!