Use MySQL to authenticate ProFTPD User _ MySQL

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.