.TH dbmmanage 1 "March 1998"
.\" Copyright (c) 1998-1999 The Apache Group. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer. 
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in
.\"    the documentation and/or other materials provided with the
.\"    distribution.
.\"
.\" 3. All advertising materials mentioning features or use of this
.\"    software must display the following acknowledgment:
.\"    "This product includes software developed by the Apache Group
.\"    for use in the Apache HTTP server project (http://www.apache.org/)."
.\"
.\" 4. The names "Apache Server" and "Apache Group" must not be used to
.\"    endorse or promote products derived from this software without
.\"    prior written permission.
.\"
.\" 5. Products derived from this software may not be called "Apache"
.\"    nor may "Apache" appear in their names without prior written
.\"    permission of the Apache Group.
.\"
.\" 6. Redistributions of any form whatsoever must retain the following
.\"    acknowledgment:
.\"    "This product includes software developed by the Apache Group
.\"    for use in the Apache HTTP server project (http://www.apache.org/)."
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" ====================================================================
.\"
.\" This software consists of voluntary contributions made by many
.\" individuals on behalf of the Apache Group and was originally based
.\" on public domain software written at the National Center for
.\" Supercomputing Applications, University of Illinois, Urbana-Champaign.
.\" For more information on the Apache Group and the Apache HTTP server
.\" project, please see <http://www.apache.org/>.
.SH NAME
dbmmanage \- Create and update user authentication files in DBM format
.SH SYNOPSIS
.B dbmmanage
.I filename
[
.I command
] [
.I username
[
.I encpasswd
] ]
.PP
.SH DESCRIPTION
.B dbmmanage
is used to create and update the DBM format files used to store
usernames and password for basic authentication of HTTP users.
Resources available from the
.B httpd
Apache web server can be restricted to just the users listed
in the files created by 
.B dbmmanage.
This program can only be used
when the usernames are stored in a DBM file. To use a
flat-file database see 
\fBhtpasswd\fP.
.PP
This manual page only lists the command line arguments. For details of
the directives necessary to configure user authentication in 
.B httpd 
see
the Apache manual, which is part of the Apache distribution or can be
found at http://www.apache.org/.
.SH OPTIONS
.IP \fB\fIfilename\fP
The filename of the DBM format file. Usually without the 
extension .db, .pag, or .dir.
.IP \fB\fIcommand\fP
This selects the operation to perform:
.TP 12
.B add
Adds an entry for \fIusername\fP to \fIfilename\fP using the encrypted
password \fIencpassword\fP.
.TP 12
.B adduser
Asks for a password and then adds an entry for \fIusername\fP to
\fIfilename\fP .
.TP 12
.B check
Asks for a password and then checks if 
\fIusername\fP is in \fIfilename\fP and if it's password matches
the specified one.
.TP 12
.B delete
Deletes the \fIusername\fP entry from \fIfilename\fP.
.TP 12
.B import
Reads username:password entries (one per line) from STDIN and adds them to
\fIfilename\fP. The passwords already has to be crypted.
.TP 12
.B update
Same as the "adduser" command, except that it makes sure \fIusername\fP
already exists in \fIfilename\fP.
.TP 12
.B view
Just displays the complete contents of the DBM file.
.IP \fB\fIusername\fP
The user for which the update operation is performed.
.PD
.SH BUGS
.PP
One should be aware that there are a number of different DBM file
formats in existance, and with all likelihood, libraries for more than
one format may exist on your system.  The three primary examples are
NDBM, the GNU project's GDBM, and Berkeley DB 2.  Unfortunately, all
these libraries use different file formats, and you must make sure
that the file format used by
.I filename
is the same format that 
.B dbmmanage
expects to see.  
.B dbmmanage
currently has no way of determining what type of DBM file it is
looking at.  If used against the wrong format, 
.dbmmanage
will simply return nothing, or may create a different DBM file with a
different name, or at worst, it may corrupt the DBM file if you were
attempting to write to it.
.PP
.B dbmmanage
has a list of DBM format preferences, defined by the 
.B @AnyDBM::ISA
array near the beginning of the program.  Since we prefer the Berkeley
DB 2 file format, the order in which
.B dbmmanage 
will look for system libraries is Berkeley DB 2, then NDBM, and then
GDBM.  The first library found will be the library
.B dbmmanage
will attempt to use for all DBM file transactions.  This ordering is
slightly different than the standard 
.B @AnyDBM::ISA
ordering in perl, as well as the ordering used by the simple dbmopen()
call in Perl, so if you use any other utilities to manage your DBM
files, they must also follow this preference ordering.  Similar care
must be taken if using programs in other languages, like C, to 
access these files.
.PP
Apache's 
.B mod_auth_db.c 
module corresponds to Berkeley DB 2 library, while
.B mod_auth_dbm.c
corresponds to the NDBM library.  Also, one can usually use the 
.B file
program supplied with most Unix systems to see what format a DBM file is in.
.PD
.SH SEE ALSO
.BR httpd(8)
.
