ProFTPD via MySQL

ProFTPD via MySQL
With mod_sql you can handle your user authentication in ProFTPD via an MySQL table.
Required is a fresh compiled actual ProFTPD with mod_sql enabled.

Enable mod_sql

./configure --with-modules=mod_sql:mod_sql_mysql


First you should create an new datebase named "proftpd" with a table named "users" in it.

Create the database and table

CREATE DATABASE proftpd;
CREATE TABLE `users` (
  `username` varchar(128) NOT NULL default '',
  `password` varchar(128) NOT NULL default '',
  `homedir` varchar(128) NOT NULL default '',
  `shell` varchar(128) NOT NULL default '',
  `uid` smallint(5) NOT NULL default '0',
  `gid` smallint(5) NOT NULL default '0',
  `last_login` datetime NOT NULL default '0000-00-00 00:00:00',
  `active` enum('0','1') NOT NULL default '1'
) TYPE=MyISAM;


Now add the following lines to your /etc/proftpd/proftpd.conf and restart the ProFTPD daemon.

/etc/proftpd/proftpd.conf

# MySQL
SQLAuthTypes         Plaintext
SQLAuthenticate      users*
SQLConnectInfo       <user>@<host> <database> <password>
SQLDefaultUID        65534
SQLDefaultGID        21
SQLMinUserUID        3000
SQLMinUserGID        21
SQLUserInfo          users username password uid gid homedir shell
SQLLog PASS login
SQLNamedQuery login UPDATE "last_login = NOW() WHERE username = '%u'" users
Dette indlæg blev udgivet i Knowledge Base, Old Base, SQL. Bogmærk permalinket.

Skriv et svar