I've installed pure-ftpd-mysql and it works fine with md5 password hashing. This isn't very secure, so I'd like to use crypt with salted sha512, the way I'm using in dovecot.

How to set up this in pure-ftpd?

Creating new user with sha512 pass:

INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`, 
  `ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`, `QuotaFiles`)
   VALUES ('MyUserName',
    ENCRYPT('_mypassword_', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))),

The values in config file:

MYSQLCrypt md5
MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*"  OR ipaccess LIKE "\R")

So my question is what do I need to put in the config file to have the password generated using the above method working.

I thought that changing MYSQLCrypt to crypt should be enough. But this does not work.

In case any other method does not work the manual describes how to create a authentication module http://download.pureftpd.org/pure-ftpd/doc/README.Authentication-Modules (but how do I enable it?)


pure-ftpd-mysql supports sha512 crypt with salt.

It's as easy as:

MYSQLCrypt crypt

And do make sure that your Password column is long enough. For crypt $6$ it's 106 characters.

So the table structure working with your query might be like this:

 User varchar(16) NOT NULL default '',
 status enum('0','1') NOT NULL default '0',
 Password varchar(106) 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,
 UNIQUE KEY User (User)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.