Распаковуем, заходим в распакованый каталог.
Создаём файлик install.sh, вписываем в него вот это
- ./configure --prefix=/usr/local/pureftpd --with-rfc2640 --with-paranoidmsg --with-virtualchroot --with-mysql=/usr/local/mysql --with-peruserlimits --with-throttling --with-ratios --with-cookie --with-quotas --with-sysquotas --with-largefile --with-tls --with-certfile=/usr/local/openssl/ssl/certs/ftp.pem --with-altlog
$ sh config.sh
$ make
$ su
# make install
# cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/
# chmod +x /usr/local/sbin/pure-config.pl[/list]
Для работы нашего фтп-сервера нужно создать базу данных, пользователя и таблицу пользователей, а также создать конфигурациооные файлы PurFTPd.
Начнем с базы. Структуру нашей базы пользоватлей фтп мы тоже создадим в отдельном файле.
- CREATE TABLE users (
user varchar(16) NOT NULL default '',
password varchar(64) NOT NULL default '',
uid int(11) NOT NULL default '10000',
gid int(11) NOT NULL default '10000',
dir varchar(128) NOT NULL default '',
userip varchar(15) NOT NULL default '',
serverip varchar(15) NOT NULL default '',
quotasize int(11) NOT NULL default '0',
ulbandwidth int(11) NOT NULL default '0',
dlbandwidth int(11) NOT NULL default '0',
ulratio int(11) NOT NULL default '0',
dlratio int(11) NOT NULL default '0',
PRIMARY KEY (user)
);
### наш первый пользователь ###
INSERT INTO users (user,password,uid,dir) \
VALUES ('admin', md5('my_password'), '1001', '/home/admin');
- $ mysql -u root -p
- mysql> CREATE DATABASE pureftpd;
mysql> GRANT ALL PRIVILEGES ON pureftpd.* TO pureftpd@localhost
-> IDENTIFIED BY 'my_base_password' WITH GRANT OPTION;
mysql> use pureftpd;
mysql> \. pureftpd.sql
mysql> \q
Файл конфигурации самого сервера.Создан он в папке /usr/local/pureftp/etc/- ### Configuration file for pure-ftpd wrappers ###
ChrootEveryone no
BrokenClientsCompatibility no
MaxClientsNumber 50
Daemonize yes
MaxClientsPerIP 8
VerboseLog no
DisplayDotFiles yes
AnonymousOnly no
NoAnonymous yes
SyslogFacility ftp
DontResolve yes
MaxIdleTime 15
MySQLConfigFile /usr/local/etc/pureftpd-mysql.conf
LimitRecursion 2000 8
AnonymousCanCreateDirs no
MaxLoad 4
AntiWarez yes
Umask 133:022
MinUID 100
AllowUserFXP no
AllowAnonymousFXP no
ProhibitDotFilesWrite no
ProhibitDotFilesRead no
AutoRename no
AnonymousCantUpload yes
CreateHomeDir no
PIDFile /var/run/pure-ftpd.pid
MaxDiskUsage 99
CustomerProof yes
TLS 1
- pureftpd-mysql.conf
MYSQLSocket /tmp/mysql.sock
MYSQLUser pureftpd
MYSQLPassword ваш пароль
MYSQLDatabase pureftpd
MYSQLCrypt MD5
MYSQLGetPW SELECT Password FROM users WHERE User="\L" AND UserIP="\R"
MYSQLGetUID SELECT Uid FROM users WHERE User="\L"
MYSQLGetGID SELECT Gid FROM users WHERE User="\L"
MYSQLGetDir SELECT Dir FROM users WHERE User="\L"
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="\L"
MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L"
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L"
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L"
- # chmod 600 /usr/local/pureftpd/etc/pureftpd-mysql.conf
- #!/bin/bash
#
# Startup script for the pure-ftpd FTP Server $Revision: 1.3 $
#
# chkconfig: 2345 85 15
# description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd
# processname: pure-ftpd
# pidfile: /var/run/pure-ftpd.pid
# config: /etc/pure-ftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
RETVAL=0
# Path to the pure-ftp binaries.
prog=pure-config.pl
fullpath=/usr/local/pureftpd/sbin/$prog
pureftpwho=/usr/local/sbin/pure-ftpwho
start() {
echo -n $"Starting $prog: "
$fullpath /usr/local/pureftpd/etc/pure-ftpd.conf --daemonize --fscharset=KOI8-R --clientcharset=WINDOWS-1251 --chrooteveryone
RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
echo
}
stop() {
echo -n $"Stopping $prog: "
kill $(cat /var/run/pure-ftpd.pid)
RETVAL=$?
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$prog ] ; then
stop
# avoid race
sleep 3
start
fi
;;
status)
status $prog
RETVAL=$?
if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then
$pureftpwho
fi
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit $RETVAL
- /etc/init.d/pureftpd start
- mysql> CREATE DATABASE pureftpd;