Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

using mod_auth_db for Basic Authentication

Jul 31, 2007 11:28PM PDT

I am trying to setup controlled access to a directory under Apache Apache/1.3.27 on Linux 2.4.9-e

I have setup the following .htaccess
====================================
# -Test DB Basic Authentication-
AuthName "Members Area"
AuthType Basic
AuthDBUserFile /var/www/html/testaccessdb/passwords.db
AuthDBGroupFile /var/www/html/testaccessdb/passwords.db
require valid-user
====================================
I built the database with this php
------------------------------------
<html><head></head>
<body>
<?php
$id = dba_open("/var/www/html/testaccessdb/passwords.db", "c");
if (!$id) {
echo "dba_popen failed<br>\n";
exit;
}
dba_replace("tester", crypt("pwtest","de"), $id);
if (dba_exists("tester", $id)) {
echo dba_fetch("tester", $id);
}
echo "<br>\nPassword Created<br><hr>";
dba_close($id);
?>
</body></html>
------------------------------------

The db file created looks like this
++++++++++++++++++++++++++++++++++++++++
6
tester13
deZWP7mwouj6A
++++++++++++++++++++++++++++++++++++++++

All this looks good but does not work.
I get the password dialog prompt
but the user / pw of tester / pwtest does not work

I suspect that I may be using the wrong 'Berkley DB' format but I really cannot find anything to tell me what the password file should look like.

Discussion is locked