FTP controlled by SQL
Mark Johnston
mjohnston at skyweb.ca
Wed Mar 16 11:54:37 PST 2005
On Wed, 2005-03-16 at 13:45 -0500, Scott St. John wrote:
> I have a client who wants to be able to add/remove users to an FTP site.
> They do not have access to the machine so this sounds like a job for PHP and
> MySQL. I have been trying (pulling hair out) with Proftp and MySQL.
>
> My question is: is anyone on the list doing something like this and what
> are you using?
I'm doing something very like this, using the ProFTPD port version
1.2.10_1 and PostgreSQL. Relevant config chunks:
AuthPAM off
DefaultRoot ~
SQLConnectInfo dbname at db.host.fqdn username password
SQLAuthenticate users # Could also use groups
SQLAuthTypes Plaintext # Passwords are stored as plaintext
SQLHomedirOnDemand on # Create missing home directories
SQLNegativeCache on # Cache missing usernames
SQLDefaultGID 10000 # Everyone will get this GID
SQLMinUserUID 10000 # Users must be at least UID 10000
SQLNamedQuery getuser SELECT "name, password, uid, NULL, '/home/' ||
name, NULL FROM domain WHERE name = '%U' AND enabled"
SQLUserInfo custom:/getuser
Basically, this turns off PAM, and authenticates using the given SQL
query. It doesn't use groups (everyone gets the DefaultGID of 10000).
The order in the SQLNamedQuery is significant - it's name, password,
numeric uid, numeric gid, home directory, something else (sorry). %U is
the username the user entered.
Management of the database table is done with an internal web front-end,
but it's a trivial matter of programming anyway. PHP sounds eminently
suitable.
HTH,
Mark
More information about the freebsd-isp
mailing list