Use MySQL to authenticate ProFTPD User _ MySQL
Last Update:2018-04-20
Source: Internet
Author: User
1. apt-getupdate: Update Database 2. apt-getmysql-clientmysql-server installation MySQL3.apt-getproftpd-mysql installation supports MySQL's ProFTPD4.mysql-uroot-p use Root to log on to MySQL, createdatabaseftpdb create ftpdb database grantselect, updateonftpdb. * toproftp 1. apt-get update // update the database
2. apt-get mysql-client mysql-server // install MySQL
3. apt-get proftpd-mysql // install ProFTPD that supports MySQL
4. mysql-uroot-p // use Root to log on to MySQL,
Create database ftpdb // create an ftpdb database
Grant select, update on ftpdb. * to proftpd @ "%" identified by 'password' // add a user to access the ftpdb database, user name proftpd, and password
Use ftpdb // perform operations on the ftpdb Library
# Ftpgroup table structure
Create table 'ftpgroup '(
'Groupname' varchar (16) not null default '',
'Gid' smallint (6) not null default '20140901 ',
'Members 'varchar (16) not null default '',
KEY 'groupname' ('groupname ')
) TYPE = MyISAM;
# Insert a record
Insert into 'ftpgroup' VALUES ('ftpgroup', 5500, 'ftpuser ');
# Ftpuser table structure
Create table 'ftpuser '(
'Id' int (10) unsigned not null auto_increment,
'Userid' varchar (32) not null default '',
'Passwd' varchar (32) not null default '',
'Uid' smallint (6) not null default '123 ',
'Gid' smallint (6) not null default '20140901 ',
'Homedir' varchar (255) not null default '',
'Shell 'varchar (16) not null default'/sbin/nologin ',
'Count' int (11) not null default '0 ',
'Accessed' datetime not null default '2017-00-00 00:00:00 ',
'Modified' datetime not null default '2017-00-00 00:00:00 ',
Primary key ('id ')
) TYPE = MyISAM;
# Insert a record
Insert into ftpuser (userid, passwd, uid, gid, homedir, shell) VALUES
('Ftpuser', 'ftpasswd', 5501,550 0, '/tony', '/sbin/nologin'); // Directory/tony should exist
5. modify/etc/proftpd. conf
Add the following content:
########################################
DefaultRoot ~
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users * groups *
SQLConnectInfo ftpdb @ localhost proftpd password
SQLUserInfo ftpuser userid passwd uid gid homedir shell
SQLGroupInfo ftpgroup groupname gid members
SQLMinID 500
SQLHomedirOnDemand on
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count = count + 1, accessed = now () WHERE userid = '% u'" ftpuser
SQLLog STOR, DELE modified
SQLNamedQuery modified UPDATE "modified = now () WHERE userid = '% u'" ftpuser
DeferWelcome on
RootLogin off
RequireValidShell off
########################################
6./etc/init. d/proftpd stop
/Etc/init. d/proftpd start // use/etc/init. d/proftpd restart as expected.
7. use
User Name: ftpuser
Password: ftppasswd
Test