Mod Auth MySQL Under Apache 2 and Debian
|
This guide will show you how to use mod_auth_mysql with Apache 2 and Debian. Firstly if you haven't alrteady done so throw some of the essentials on such as Apache 2 / PHP 4 / MySQL apt-get install libapache2-mod-php mysql-server php4-mysql libapache2-mod-auth-mysql Next we need to enable the module, unlike Apache 1, we don't need to modify any configuration files to add sometype of LoadModule statement, simply: ln -s /etc/apache2/mods-available/auth_mysql.load . Next we need to set the root password for MySQL mysqladmin -u root password <password> Then we need to login into MySQL mysql -uroot -p mysql> grant all on auth.* to auth_user@localhost identified by '<password>'; mysql> flush privileges; mysql> create database auth; CREATE TABLE `clients` ( Changing <username>, <password> and <group> accordingly. Next we need to modify our Apache 2 configuration. vi /etc/apache2/apache2.conf Add the following line to the end of this file Auth_MySQL_Info localhost <auth_user> <password> Adjusting <auth_user>, <password> and <web directory> for the directories you wish to be processed by Apache containing .htaccess files with the relevant directives information. Restart Apache 2 apache2ctl restart Finally place an .htaccess file in the directory you wish to protect using mod_auth_mysql. It needs to contain the following structure: AuthMYSQL on With that file in place it will check the group field in the MySQL and authenicate any users that belong to that particular group, require group can be changed to require a valid user instead if required and multiple groups can be allowed by simply adding a space after the last group to the file looks like: AuthMYSQL on
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com
Red Hat Virtual Experience - a free virtual event. Dec. 9th







Recent comments
6 hours 16 min ago
12 hours 4 min ago
13 hours 56 min ago
15 hours 41 min ago
19 hours 31 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 5 hours ago
1 day 11 hours ago
1 day 16 hours ago