This HOWTO will describe how to setup ProFTPd using MySQL as the authentication mechanism for your users and user home directories. This HOWTO ties in with my previous HOWTO for setting up a fully-fledged e-mail system with WebMail, POP3, and SMTP authentication. This works perfectly on Ubuntu Linux Server Gutsy 7.10.
First, we want to download the ProFTPd software from the repsitories:
sudo apt-get install proftpd
After the system is setup, it will automatically have all of the ProFTPd modules downloaded. The ProFTPd module location is at /usr/lib/proftpd. If you would like to navigate there, you can ensure that the "mod_sql" module is installed by looking for the "mod_sql.a" and "mod_sql.la" files. If they are, lets continue on.
The next step is to modify the ProFTPd configuration file. The ProFTPd configuration location is /etc/protfpd/proftpd.conf.
Open this file up and there are a few things to do. Here is the code that I used:
DefaultRoot ~ # This will ensure that the users can only work within their home directory
OK, so those are all the basic options. Ensure you put the name of your server where I put in SERVER_NAME_HERE.
Now, lets do the configuration for using SQL. Note that with the configuration below, I used a MySQL database. The database name was called "horde" (so that way I have one database for all authentication on my systems), the table within the database that contains user information is "horde_users", the username to gain access to the database is "horde3" and the password I simply put PASSWORD_HERE.
SQLConnectInfo horde horde3 PASSWORD_HERE
SQLAuthenticate users # I am authenticating the users only, not authenticating groups
SQLUserInfo horde_users user_uid user_pass NULL NULL www NULL
The last line of code that starts with SQLUserInfo, lets go over that quickly here.
horde_users – The name of the table within database 'horde' (specified in SQLConnectInfo) that contains all the user information
user_uid – The field that contains the user's login ID they will use to login to FTP
user_pass – The field that contains the user's plaintext password they use to authenticate their account
NULL – This is put in there because there is no need to pull the user's ID number Linux assigns.
NULL – This is put in there because there is no need to pull the group ID number Linux assigns
www – This is the field that contains the user's home directory. This will ensure that when the user logs in, they will go to this directory that they have full control of.
NULL – This was put in there because none of the users have a shell that they have access to.
OK, thats it! Save the configuration file and then restart ProFTPd:
sudo /etc/init.d/proftpd restart
As long as you have information filled out and the database created, you should now be able to login to FTP!