PureFTP安装笔记

本笔记只记录配置freebsd系统下的pureftp服务器的安装配置,含web管理界面,mysql数据库存储用户数据,本笔记虽然是在FreeBSD系统上测试通过,其中多数内容也适合各个Linux发行版本以及各个BSD分支,在其他系统上只需要做少量调整。

 
[[email protected] /]#pw groupadd ftp -g 21
[[email protected] /]#pw useradd ftp -g ftp -d /home/ftp -s /nonexistent
[[email protected] /]#mkdir /home/ftp
[[email protected] /]#chown -R ftp:ftp /home/ftp
[[email protected] /]#cd /usr/ports/ftp/pure-ftpd
[[email protected] /]#make install clean
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
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[X] PRIVSEP        Enable privilege separation                  x 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[X] UTF8           Support for charset conversion (expreimental)x x
x x[X] SENDFILE       Support for the sendfile syscall             x x
[[email protected] /]#echo 'pureftpd_enable="YES"' >> /etc/rc.conf
[[email protected] /]#cd /usr/local/etc/
[[email protected] /]#mv pure-ftpd.conf.sample pure-ftpd.conf
[[email protected] /]#mv pureftpd-mysql.conf.sample pureftpd-mysql.conf
[[email protected] /]#vi /usr/local/etc/pure-ftpd.conf
MySQLConfigFile               /usr/local/etc/pureftpd-mysql.conf
:wq!
[[email protected] /]#vi /usr/local/etc/pureftpd-mysql.conf
MYSQLServer     127.0.0.1
MYSQLPort       3306
MYSQLSocket     /tmp/mysql.sock
MYSQLUser       ftp
MYSQLPassword   yourpasswordwww.itkylin.com
MYSQLDatabase   ftpusers
MYSQLCrypt      md5
MYSQLGetPW      SELECT Password FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MYSQLGetUID     SELECT Uid FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MYSQLGetGID     SELECT Gid FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MYSQLGetDir    SELECT Dir FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MySQLGetQTAFS  SELECT QuotaFiles FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MySQLGetQTASZ  SELECT QuotaSize FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "R")
:wq
[[email protected] /]#cd /root/
[[email protected] /]#fetch "http://machiel.generaal.net/files/pureftpd/v2.x/script.mysql"
[[email protected] /]#vi script.mysql
change:
INSERT INTO admin VALUES ('Administrator',MD5('tmppasswd'));
to:
INSERT INTO admin VALUES ('root',MD5('yourpasswordwww.itkylin.com'));
:wq
[[email protected] /]#mysql -u root -p < script.mysql
Enter password:yourpasswordwww.itkylin.com
[[email protected] /]#cd /usr/local/www/
[[email protected] /]#fetch "http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz"
[[email protected] /]#tar -zxvpf ftp_v2.1.tar.gz
[[email protected] /]#chown -R vmail:vmail ftp
[[email protected] /]#cd ftp
[[email protected] /]#chown vmail config.php
[[email protected] /]#vi /usr/local/etc/apache2/httpd.conf
add:
Alias /ftpadmin/    "/usr/local/www/ftp/"
<Directory "/usr/local/www/ftp">
        Options Indexes
        AllowOverride ALL
        #AllowOverride AuthConfig
        Order allow,deny
        Allow from all
</Directory>
:wq
[[email protected] /]#/usr/local/etc/rc.d/apache2.sh restart
[[email protected] /]#/usr/local/etc/rc.d/pure-ftpd start
https://www.itkylin.com/ftpadmin/install.php

---->Step 2--->New installation,create a new database.

---->localhost、root、yourpasswordwww.itkylin.com  --->connect

---->Continue-->127.0.0.1、ftp、yourpassword、ftpusers--->Step 4

-->127.0.0.1、ftp、yourpassword、ftpusers、Chinese、www.itkylin.com:21、
images、images、65534、65534、/etc/passwd、/etc/group、Default.css、Quota support V 、 Ratio support V -->Save

-->Step 5

--->password:yourpasswordwww.itkylin.com

[[email protected] /]#cd /usr/local/www/cgi-bin/
[[email protected] /]#vi ftpstatus.c
#include 

int main(int argc, char *argv[])
{
  system("/usr/local/sbin/pure-ftpwho -H -w");
  return 0;
}
:wq
cc -Wall -o ftpstatus ftpstatus.c
[[email protected] /]#chmod 755 ftpstatus
[root@www.itkylin.com /]#chmod ug+s ftpstatus

OK,完成