httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <>
Subject Re: [users@httpd] How to use mod_authn_dbd and sqlite3 for authentication?
Date Tue, 24 Oct 2006 15:37:34 GMT
On Tuesday 24 October 2006 14:19, Chen Yufei wrote:
> HI,
> I've been trying to configure mod_authn_dbd ( my apache version is
> 2.2.3 ) to use sqlite3 for user authentication, two days passed but
> things still didn't work well :-(
> So here is what I did:
> 1. First I created a database file and inserted some user information
> for test using sqlite3.
> # sqlite3 userpasswd.db
> sqlite3> create table authn (user_name char(20) not null primary key,
> user_passwd char(20) not null);
> sqlite3> insert into authn values ('user', 'passwd'); # not encrypted,
> I don't know whether it should be encrypted

It should be exactly the same as if you were using a flat file.
So you can generate the password using htpasswd or htdigest,
depending on whether you want basic or digest authentication.

> 2. Then add the following configuration to httpd.conf. It's almost the
> same with the sample in the document except the arguments for DBDriver
> and DBDParams. The required modules are all loaded.
> DBDriver sqlite3
> DBDParams "/path/to/userpasswd.db" # the document says the string will
> be passed to sqlite3_open, but I didn't know what should actually
> write here.

Neither do I, but I expect the sqlite documentation does.

> #Parameters for Connection Pool Management
> DBDMin  1
> DBDKeep 2
> DBDMax  10
> DBDExptime 60

That should be fine if your volume of traffic to authenticated
areas is reasonably low.

> #Authentication Section
> <Directory /var/httpd/html/private/>
>     #mod_auth configuration for authn_dbd
>     AuthType Basic
>     AuthBasicProvider dbd
>     AuthName "private content"
>     #authz configuration
>     Require valid-user
>     #SQL query to verify a user
>     #(note: DBD drivers recognise both stdio-like %s and native syntax)
>     AuthDBDUserPWQuery "select user_passwd from authn where user_name=%s"
> </Directory>

Looks fine to me, though you might also want to specify a Satisfy.

> After that, I restarted apache, and tried to visit pages in the
> private directory. There does appears an authentication dialog asking
> for user name and password. However, after entered the same user name
> and password in the database file, I got the message "Error 500".
> Then I looked up in the error log and see this "No DBD Authn
> configured!" I've justed started learn to use apache and don't know
> what does this mean.

That's probably your DBDParams connection string.  Check for error
messages at server startup.

Nick Kew

Application Development with Apache - the Apache Modules Book

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message