Funky Clouds

B.J.’s funky little home on the net

20
Jun
2007

I just installed the mod_auth_mysql module on an old decrepit AIX 5.1 machine because it’s very stinkin’ cool to be able to use a database table instead of an htpasswd file to store user accounts. Thought I’d post my notes here in case it helps someone.

compile the bieach:

./apxs -c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient -lm -lz /src/mod_auth_mysql-3.0.0/mod_auth_mysql.c -bexpall

move the mod_auth_mysql.so into /usr/local/apache/libexec/

In httpd.conf add:
LoadModule mysql_auth_module libexec/mod_auth_mysql.so
AddModule mod_auth_mysql.c

Adding in the module with the above causes everything to try to use MySQL to auth. This breaks any existing htpasswd type ones. To use both put this in the main <directory> area

AuthMySQLEnable off

Then turn it on for the specific directories where you want to use MySQL auth.

Setup a directory to secure:
create a USER table in a database etc…

put something like this in httpd.conf:

<directory /www/htdocs/somedir/>
DirectoryIndex index.php index.html default.php index.htm
FancyIndexing on
AllowOverride AuthConfig
AuthName “My Test”
AuthType Basic
require valid-user
AuthMySQLPwEncryption scrambled
AuthMySQLHost localhost
AuthMySQLDB authdb
AuthMySQLUserTable user
AuthMySQLUser authuser
AuthMySQLPassword authpasswd
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLAuthoritative On
</directory>

apachectl restart yo

references (because i don’t come up with this stuff myself ya know):
http://www.linuxhelp.net/guides/htaccessmysql/
http://modauthmysql.sourceforge.net/CONFIGURE
http://www.webhostgear.com/215.html

Administrator

Add A Comment