PDA

View Full Version : AuthDBUserFile and .htaccess


david4514
06-22-2007, 08:37 PM
I am new at all of this so I probably have made a simple mistake.

I am trying to set up a AuthType Basic system using mod_auth_DB to protect a subdirectory. I expect to have about 500 users in the database, which seems to be more than what would be appropriate for the flat file create with htpasswd and less than what would be needed with a MySQL solution. Though, for other reasons the MySQL solution might be better. For now, I am just testing the mod_auth_DB support.

Here is an approximation of my .htaccess file (domain names, directory names, user names... changed to protect the innocent:yeah: ) which is in my directory to be protected.

AuthName "private area"
AuthType Basic
AuthDBUserFile /big/dom/xdom/secret/.password
require valid-user

I used dbmmanage to create and add users to the .password database. This seemed to work, the names displayed with the dbmmanage .password view command. The file .password command showed that it was a Berkley DB database;

When I navigate with my browser to the protected directory, the logon prompt appears, but it never succeeds. The Apache error log shows:

[Fri Jun 22 18:47:13 2007] [error] [client 68.105.184.33] (2)No such file or directory: could not open db auth file: /big/dom/xdom/secret/.password
[Fri Jun 22 18:47:13 2007] [error] [client 68.105.184.33] DB user username not found: /big/dom/xdom/www/protected_directory/index.html

As an alternative, I tried using AuthDBMUserFile directive in .htaccess. The Apache error log say that it is an invalid command.

I also tried using Auth_MySQL_* directives using the mod_auth_MySQL support and none of those directive were valid either.

phpinfo.php shows that mod_auth_db and mod_auth_mysql have been loaded into Apache. mod_auth_dbm does not show up as having been loaded.

Is there something that needs to be enabled to get database support for authentication? I hope that I am just missing something simple, but I can't seem to get any of these options to work.

sheila
06-22-2007, 11:13 PM
It sounds like you may be having an issue with file permissions. As noted in this forum post
http://www.aota.net/forums/showthread.php?postid=136671#post136671
Apache (the web server) doesn't have permission to access your HOME directory.

kitchin
06-22-2007, 11:52 PM
Is "xdom" actually xYOURACCOUNT ? Just askin'...
Otherwise, my .htaccess is just likes yours, except "require" is "Require" and ".password" is "filename.dat", so it doesn't start with a dot. Its file permissions are 0644, rw-r--r--. And .htaccess has the same permissions. Works fine.

kitchin
06-22-2007, 11:55 PM
Oh, I see what Sheila is talking about. The path I'm using is in...

AuthDBUserFile /big/dom/xMYACCOUNT/cgi-ssl/filename.dat

The owner of both filename.dat and .htaccess is my account, just like normal html files in www/.

david4514
06-23-2007, 11:04 AM
I had used xdom just as a generic name. Maybe I should have said:

AuthDBUserFile /big/dom/xMYACCOUNT/secret/.password

secret is a directory that I created under xMYACCOUNT (except that it is called something else... like this is suppose to be secret!) currently with 755 directory permissions (I'd reduce to 644 if I can get it to work)

The .password file has 644 for permissions.

I don't think this is a permission problem. I only say that because one of my earlier attempts, not even mentioned, did fail due to permission denied, and the error message was very explicit for that issue. After changing the permissions of my "secret" directory, I started getting this other message. I have also tried using a password file name with no preceding '.'. No change.

Now for the question that truly shows my ignorance! Sheila, please define what you mean by "home directory". I am assuming that it is /big/dom/xMYACCOUNT/www.

Do I need to put the password file in /big/dom/xMYACCOUNT/cgi-bin?

Terra
06-23-2007, 11:28 AM
I looked at your .htaccessDB file, and think I have found the problem...

There is no LF after the 'require valid-user' statement, which is needed to be able to properly read that line...

Wrong:
###############################
require valid-user
###############################

Correct:
###############################
require valid-user

###############################

Just make sure there is a LF at the end of the file, and it should start working for you...

--
Terra
sysAdmin
FutureQuest