您好,登錄后才能下訂單哦!
這篇文章主要介紹Pureftpd和mysql如何架設FTP服務器,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
下載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
確認以下三項
ChrootEveryone yes
MySQLConfigFile /etc/pureftpd-mysql.conf
CreateHomeDir yes
為puer-ftpd創建mysql數據庫和用戶
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”)
各參數注釋
User:用戶名
status:狀態 1為激活狀態 0為非激活狀態
Password :密碼
Uid:用戶系統ID號
GID:用戶組ID號
ULBandwidth :上傳***帶寬 單位 KB/S
DLBandwidth:下載***帶寬 單位 KB/S
comment :注釋
ipaccess :允許訪問IP地址
QuotaSize :磁盤配額總大小 單位MB
QuotaFiles :允許存放的文件數目個數 0為不限制
關掉進程
killall pure-ftpd
啟動服務
/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′);
即可用數據庫里的用戶和密碼登陸ftp
將pureftpd加載為系統服務
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
更改權限
# chmod 775 pureftpd
加入自動啟動
# chkconfig –add pureftpd
查看自動啟動設置
# 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服務
#service mysql start
#service mysql stop
若無法上傳文件,設置ftp文件夾權限
chmod -R 777 /data0/htdocs
以上是“Pureftpd和mysql如何架設FTP服務器”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。