How to authenticate Pure-FTPd by Drupal
Pure-FTPd supports various authentication source. I have an application to offer a private storage to Drupal user. In particular, every users share the same data storage since they are all friends. The scenario is that I would like to limit number of concurrent connection for each user to prevent parallel fetching by FlashGet or its friends. So I gave an individual user and limited the concurrent connection instead.
Anyway, I don't want to have duplicated accounts for both Drupal and Pure-FTPd. It would be nice if the account is shared among the two system so users may change their password by themselves.
Fortunately, Pure-FTPd supports authentication from MySQL source. I just need to specify user, password, database and queries as follow. All you have to do is simply put below content in /etc/pure-ftpd/db/mysql.conf
.
# MYSQLServer 127.0.0.1
# MYSQLPort 3306
MYSQLSocket /var/run/mysqld/mysqld.sock
MYSQLUser user
MYSQLPassword password
MYSQLDatabase drupal5
MYSQLCrypt md5
MYSQLGetPW SELECT pass FROM users WHERE name="\L"
MYSQLGetUID SELECT Uid FROM users WHERE User="\L"
MYSQLDefaultUID 1002
MYSQLGetGID SELECT Gid FROM users WHERE User="\L"
MYSQLDefaultGID 100
MYSQLGetDir SELECT "/opt/ftproot/./" as Dir
# MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L"
# MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="\L"
# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="\L"
# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="\L"
# MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L"
MySQLGetBandwidthDL SELECT 3000 as DLBandwidth
# MySQLForceTildeExpansion 1
# MySQLTransactions On
The most important values are MYSQLCrypt
, MYSQLGetPW
and MYSQLGetUID
. For more information, please see an article.
- sugree's blog
- 1081 reads
Recent comments
2 years 11 weeks ago
2 years 15 weeks ago
2 years 16 weeks ago
2 years 16 weeks ago
2 years 17 weeks ago
2 years 19 weeks ago
2 years 19 weeks ago
2 years 19 weeks ago
2 years 19 weeks ago
2 years 20 weeks ago