[WBEL-users] mod_auth_mysql

Will McDonald wmcdonald at gmail.com
Tue Jun 28 04:35:50 CDT 2005


Thomas,

I've just installed it here on WBEL4

[root at willspc www]# rpm -qa | grep mysql
mysql-server-4.1.10a-1.RHEL4.1
mysql-4.1.10a-1.RHEL4.1
mod_auth_mysql-2.6.1-2.1
php-mysql-4.3.9-3.6

Then carried out the following steps for a test directory with just a
simple index.html in it...

CREATE DATABASE auth;
USE auth;
CREATE TABLE users (
 user_name CHAR(30) NOT NULL,
 user_passwd CHAR(20) NOT NULL,
 PRIMARY KEY (user_name)
 );
 GRANT SELECT
 ON auth.users
 TO authuser at localhost
 IDENTIFIED BY 'snee';
 
 INSERT INTO users VALUES ('testuser', ENCRYPT('testpass'));

But at this stage I think you need to do a...

FLUSH PRIVILEGES;

... too, or restart MySQL, I haven't tried it without but it's second
nature to me to do this when doing a GRANT.

In /etc/http/conf.d/auth_mysql.conf I have...

LoadModule mysql_auth_module modules/mod_auth_mysql.so
<Directory /var/www/html/mysql_auth/>
    AuthName "MySQL authenticated zone"
    AuthType Basic

    AuthMySQLUser authuser
    AuthMySQLPassword snee
    AuthMySQLDB auth
    AuthMySQLUserTable users
    AuthMySQLNameField user_name
    AuthMySQLPasswordField user_passwd

    require valid-user
</Directory>

Then a quick

# /etc/rc.d/init.d/httpd reload

... and it seems to be up and running. I get prompted for
authentication accessing http://willspc/mysql_auth/index.html and
login with testuser/testpass. Your error looks to me like a DB
permissions issue so I'd drop the auth database (assuming there's only
test data in it), re-create it and flush the privileges. Or you could
just try a quick "service mysql restart"?

Will

On 6/28/05, Thomas E Dukes <edukes at alltel.net> wrote:
> Hello,
> 
> I was trying to get this mod working but have be unable to do so.  I created
> the database and table following the 'basic authorization' example in
> mod_auth_mysql.conf.
> 
> Here are my files:
> 
> Mod_auth_mysql:
> 
> #
> 
> LoadModule mysql_auth_module modules/mod_auth_mysql.so
> 
> # This will enable user-based MySQL authentication of everything
> # within /var/www.  You'll need to do the following as the MySQL
> # root user beforehand:
> #
> #    CREATE DATABASE auth;
> #    USE auth;
> #    CREATE TABLE users (
> #      user_name CHAR(30) NOT NULL,
> #      user_passwd CHAR(20) NOT NULL,
> #      PRIMARY KEY (user_name)
> #    );
> #    GRANT SELECT
> #      ON auth.users
> #      TO authuser at localhost
> #      IDENTIFIED BY 'PaSsW0Rd';
> #
> #    INSERT INTO users VALUES ('testuser', ENCRYPT('testpass'));
> #
> <Directory /var/www/html/phpMyAdmin>
>    AuthName "phpMyAdmin Access"
>    AuthType Basic
>    AuthMySQLUser authuser
>    AuthMySQLPassword PaSsW0Rd
>    AuthMySQLDB auth
>    AuthMySQLUserTable users
>    AuthMySQLNameField user_name
>    AuthMySQLPasswordField user_passwd
>    require valid-user
> </Directory>
> 
> .htaccess:
> 
> AuthName "phpMyAdmin Access"
> AuthType Basic
> AuthMySQLHost localhost
> AuthMySQLDB auth
> AuthMySQLUserTable users
> AuthMySQLEnable On
> require valid-user
> 
> Apache error log:
> 
> [Mon Jun 27 21:19:24 2005] [error] [client 151.213.91.37] MySQL ERROR:
> SELECT command denied to user ''@'localhost' for table 'users': /phpMyAdmin/
> [Mon Jun 27 21:19:24 2005] [error] [client 151.213.91.37] MySQL user
> testuser not found: /phpMyAdmin/
> [Mon Jun 27 21:19:36 2005] [error] [client 151.213.91.37] MySQL ERROR:
> SELECT command denied to user ''@'localhost' for table 'users': /phpMyAdmin/
> [Mon Jun 27 21:19:36 2005] [error] [client 151.213.91.37] MySQL user
> testuser not found: /phpMyAdmin/
> [Mon Jun 27 21:19:49 2005] [error] [client 151.213.91.37] MySQL ERROR:
> SELECT command denied to user ''@'localhost' for table 'users': /phpMyAdmin/
> [Mon Jun 27 21:19:49 2005] [error] [client 151.213.91.37] MySQL user
> testuser not found: /phpMyAdmin/
> 
> This has me stumped.  Been working on it for 2 days now.  :-(
> 
> Any help would be appreciate!
> 
> 
> 
> _______________________________________________
> Whitebox-users mailing list
> Whitebox-users at beau.org
> http://beau.org/mailman/listinfo/whitebox-users
>



More information about the Whitebox-users mailing list