If you have any questions, you should discuss it, you should use it!
PHP code:
-------------------------------------- PureftPD installation documentation --------- ----------------------------
Required software
Pure-ftpd-1.0.21.tar.gz
Pureftpd_php_manager.tar.gz
Comprehensive setting
TAR ZVXF PURE-FTPD-1.0.21.tar.gz
CD pure-ftpd-1.0.21
#. / configure --prefix = / usr / local / pureftpd --with-mysql = / usr / local / mysql --with-paraNidMSG
--with-shadow --with-welcomemsg --with-uploadscript --with-quotas --with-cookie --with-Pam
--With-VirtualHosts --with-VirtualRoot --with-diraliases --with-sysquotas --with-Ratios
--with-ftpwho --with-shrottling --with-language = Simplified-Chinese
Make
Make Check
Make Install
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
Edit pure-ftpd.conf by pressing your needs
-------------------------------------
# CAGE IN EVERY USER IN HOS Home Directory
# Limit each user to your own root directory
Chrooteveryone Yes
# Disallow anonymous connection. Only Allow Authenticated Users.
# Cancel anonymous user
Noanonymous Yes
# MySQL Configuration FILE (See Readme.Mysql)
# pfFTPD-mysql.conf file location
MySQLCONFIGFILE /USR /LOCAL/Etc/pureftpd-mysql.conf
CreateHomedir Yes
-------------------------------------
TAR ZVXF PUREFTPD_PHP_MANAGER.TAR.GZ
CD pureftpd_php_manager
MV pureftpd-mysql.conf.sample /usr/local/etc/pureftpd-mysql.conf
CD ..
CP -R pureft_php_manager / home / www / pureftpd_php_manager
CD / home / www / pureft_php_manager
Vi pureftp.config.php
Follow your needs to modify the settings code:
-------------------------------------------------- -----------------------------------
// Set the location of the pureftpd-mysql.conf, this should be noted, don't write wrong.
$ Pureftp_config_file = '/usr/local/etc/pureftpd-mysql.conf';// the location where all the form s Directed to. (Mayby No change Need)
$ Self_URL = 'Index.php';
// the location of your pure-ftpdwho binary 4711)
$ Ftp_who = "/ usr / local / sbin / pure-ftpwho";
$ Defaultuser = "ftpuser"; # default user
$ DEFAULTPASS = ""; # default initial user password
$ Defaultuid = "2002"; # default UID (set to ftpusers)
$ Defaultgid = "2002"; # default GID (GID set to ftpusers)
$ Defaultdir = "/ var / ftproot / ftpusershome"; # default user home directory
$ Defaultul = "0"; # default user upload speed limit (KB / S)
$ Defaultdl = "0"; # default user download rate limit (KB / S)
$ DEFAULTIP = "*"; # Set which IP can log in
$ Defaultqs = "50"; # User default quota
$ Defaultcmt = ""; # default note information
$ Defaultqf = "0"; # default file number quota
$ PWC = "55"; # vorsatz Fuerr Crypt Password
-------------------------------------------------- -----------------------------------
Increase user groups and users
#groupadd ftpusers -g 2002
# uSERADD FTP -U 2002 -G ftpusers -s / sbin / nologin
Delete extra things
RM -F History.txt PureftPD-MySql.conf.sample
If you want to use a real use, it is best to use Apache to do authentication!
Add an FTP User Database in MySQL
Code:
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;
------------------------------ Encrypted pureftpd_php_manager directory -------------------------------------------------------------------------------------------------------------------------- -----------
Because we are putting it online, you must don't want everyone to go to see your FTP users!
I usually use htpasswd verification, please do this, still use the example in front:
My pureft_php_manager directory is located in /Home/onlinecq.com/pureftpd_php_manager directory, I need to be in Apache
Add the following summary of the host:
Deny from all
Options none
ALLOWOVERRIDE AUTHCONFIG
ORDER DENY, ALOW
Directory>
In this way, if someone wants to enter the directory, we must verify through Apache to ensure our security (not absolutely safe)
CD / home / www / pureft_php_manager
Then enter the directory of the pureft_php_manager, use the VI to create a .htaccess authentication file:
Vi .htaccess
The content is as follows:
Authtype Basic
Authorfile /usr/www/bin/pureftpd.passwd
Authname pureftpd
Require Valid-User
Satisfy Any
After the deployment is exited, we can use the htpasswd command to add the user who allows you to enter the directory!
CD / USR / WWW / BIN /
Enter this directory
./htpasswd -bc pureftpd.passwd ltsnet 980405
This will create a pureft.passwd authentication file in your current directory, the username is FTP, the password is 123654, you can
Change it to yourself.
Ok, it looks almost, trouble you to restart Apache test, if you have a smooth, congratulations, everything is successful!
------------------ Editor /usR/local/etc/pureftpd-mysql.conf ------------------- -------
Vi /usr/local/etc/pureftpd-mysql.conf
The newly built user and password just in MySQL is added, the option is very simple, as long as you pay attention to not output
MySQLServer 127.0.0.1
#Mysql server IP
Mysqlport 3306
#Mysql port number
Mysqlsocket /var/lib/mysql/mysql.sock
# Local connection with UNIX.SOCK
Note: MySQLServer is selected with mysqlsocket.
MySQLUSER FTP # mysqluser Data User Name
MySQLPassword 123456
#Mysql database user's password
MySQLDATABASE FTPUSERS
#FTP Database
MySQLCrypt MD5
# 密 加 加密 方式 "Cleartext", "Crypt", "MD5" and "password"
# Cleartext plaintext, Crypt, MD5, Password is the Backend Password ('Your-Passwd') function (used by mySQL database)
PASSWORD () function)
MySQLGETPW SELECT Password from users where user = "l"
# Password field, I use Password in the UserS table as a password field
MysqlgetUid select uid from users where user = "l"
#Uid user ID field
Mysqldefaultuid 1000
# Default UID (Note: How to turn on this option, mysqlgetuid will lose its role)
Mysqlgetgid Select Gid from users where user = "l"
#GID group ID field
MySQLDEFAULTGID 1000
# Default GID (Note: How to turn on this option, mysqlgetgid will lose its role)
Mysqlgetdir select Dir from users where user = "l"
#FTP User Directory, such as / Home / Web / WWW-9812-Net
MySQLGETQTAFS SELECT Quotafiles from users where user = "l"
# 磁 limit, file number limit. Such as 1000, allow users to upload 1,000 files
MySQLGETQTASZ SELECT Quotasize from users where user = "l"
# 限, ftp user space limit (M), such as: 100m
MySQLGETRATIOUL SELECT ULRATIO from Uses Where User = "L"
MySQLGETRATIODL SELECT DLRATIO from Uses Where User = "L"
# Upload / download ratio. MySQLGETRATIOUL is a mysqlgetratiodl download ratio. Such as: 1: 5
MysqlgetBandWidthul Select Ulbandwidth from users Where user = "l"
MysqlgetBandwidthdl Select Dlbandwidth from users where user = "l"
# 下 传 / download bandwidth (unit Kb / s). MySQLgetBandWidthul upload bandwidth, mysqlgetbandwidthdl download bandwidth. For upload
500kb / s, download 50kb / s
MySQLFORCETILDEEXPANSION 1
MySQLTRANSACTIONS ON
start up
# / usr / local / sbin / pure-config.pl /usr/local/etc/pure-ftpd.conf
Then test http://ip/pureft_php_manager/index.php Add a user, then log in with the FTP client Try, OK!
-------------------------------------- Automatic start (1) ------- ---------------------------
PureftP supports a variety of boot mode, and it is the easiest type:
vi /etc/rc.d/rc.local
Add to
CD / usr / local / pureftpd / sbin
./pure-ftpd -a -b -c 1 -c 50 -e -g -i 2 -l unix -l puredb: /usr/local/pureftpd/pureftpd.pdb -p
4000: 50000 -R -W
------------------------------------- Startup script (2) This kind of easy-to-use ---- ------------------------------
Built a pureftpd.sh in /usr/local/etc/rc.d
CHMOD U X Pureftpd.sh
You can: /usr/local/etc/rc.d/pureftpd.sh start
/usr/local/etc/rc.d/pureftpd.sh stop
#! / bin / sh
Case "$ 1" in
START)
[-x /usr/local/etc/pure-ftpd.conf] &&
/usR/local/sbin/pure-config.pl/usr/local/etc/pure-ftpd.conf> / dev / null &&
echo -n 'pure-ftp'
;
STOP)
Killall Pure-ftpd> / dev / null &&
echo -n 'pure-ftp'
;
*)
Echo "USAGE:` BaseName $ 0` {Start | Stop}> & 2
;
ESAC
EXIT 0
Attachment: PHP program for Pure-ftpd.rar management FTP