Configurer un PureFTPd avec un backend MySQL sous Ubuntu

En trois étapes :

Premièrement, l'installation à partir des packages :

$ sudo apt-get install pure-ftpd-mysql

Deuxièmement, création de l'user, de la base et de la table kivonbien sur un serveur MySQL :

CREATE DATABASE pureftpd;
GRANT SELECT ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'XXXXXX';
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`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Troisièmement on paramètre le PureFTPd. D'abord dans /etc/pure-ftpd/db/mysql.conf :

MYSQLSocket      /var/run/mysqld/mysqld.sock
MYSQLUser       pureftpd
MYSQLPassword   XXXXXXXX
MYSQLDatabase   pureftpd
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")

Et ensuite on n'oublie pas de créer le fichier /etc/pure-ftpd/conf/ChrootEveryone avec comme valeur "yes".

Si je ne me suis pas planté, c'est tout (pour le moment).

(PS : ceci est un post perdu !)