1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5              This file is generated from xml source: DO NOT EDIT
6        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7      -->
8<title>htdbm - Manipulate DBM password databases - Apache HTTP Server</title>
9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
12<script src="/style/scripts/prettify.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body id="manual-page"><div id="page-header">
17<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
18<p class="apache">Apache HTTP Server Version 2.2</p>
19<img alt="" src="/images/feather.gif" /></div>
20<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
21<div id="path">
22<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>htdbm - Manipulate DBM password databases</h1>
23<div class="toplang">
24<p><span>Available Languages: </span><a href="/en/programs/htdbm.html" title="English">&nbsp;en&nbsp;</a> |
25<a href="/tr/programs/htdbm.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
26</div>
27
28    <p><code>htdbm</code> is used to manipulate the DBM format files used to
29    store usernames and password for basic authentication of HTTP users via
30    <code class="module"><a href="/mod/mod_authn_dbm.html">mod_authn_dbm</a></code>.  See the <code class="program"><a href="/programs/dbmmanage.html">dbmmanage</a></code>
31    documentation for more information about these DBM files.</p>
32</div>
33<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
34<li><img alt="" src="/images/down.gif" /> <a href="#options">Options</a></li>
35<li><img alt="" src="/images/down.gif" /> <a href="#bugs">Bugs</a></li>
36<li><img alt="" src="/images/down.gif" /> <a href="#exit">Exit Status</a></li>
37<li><img alt="" src="/images/down.gif" /> <a href="#examples">Examples</a></li>
38<li><img alt="" src="/images/down.gif" /> <a href="#security">Security Considerations</a></li>
39<li><img alt="" src="/images/down.gif" /> <a href="#restrictions">Restrictions</a></li>
40</ul><h3>See also</h3><ul class="seealso"><li><code class="program"><a href="/programs/httpd.html">httpd</a></code></li><li><code class="program"><a href="/programs/dbmmanage.html">dbmmanage</a></code></li><li><code class="module"><a href="/mod/mod_authn_dbm.html">mod_authn_dbm</a></code></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
41<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
42<div class="section">
43<h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
44    <p><code><strong>htdbm</strong>
45    [ -<strong>T</strong><var>DBTYPE</var> ]
46    [ -<strong>c</strong> ]
47    [ -<strong>m</strong> |
48      -<strong>d</strong> |
49      -<strong>p</strong> |
50      -<strong>s</strong> ]
51    [ -<strong>t</strong> ]
52    [ -<strong>v</strong> ]
53    [ -<strong>x</strong> ]
54    <var>filename</var> <var>username</var></code></p>
55
56    <p><code><strong>htdbm</strong> -<strong>b</strong>
57    [ -<strong>T</strong><var>DBTYPE</var> ]
58    [ -<strong>c</strong> ]
59    [ -<strong>m</strong> |
60      -<strong>d</strong> |
61      -<strong>p</strong> |
62      -<strong>s</strong> ]
63    [ -<strong>t</strong> ]
64    [ -<strong>v</strong> ]
65    <var>filename</var> <var>username</var> <var>password</var></code></p>
66
67    <p><code><strong>htdbm</strong> -<strong>n</strong>
68    [ -<strong>c</strong> ]
69    [ -<strong>m</strong> |
70      -<strong>d</strong> |
71      -<strong>p</strong> |
72      -<strong>s</strong> ]
73    [ -<strong>t</strong> ]
74    [ -<strong>v</strong> ]
75    <var>username</var></code></p>
76
77    <p><code><strong>htdbm</strong> -<strong>nb</strong>
78    [ -<strong>c</strong> ]
79    [ -<strong>m</strong> |
80      -<strong>d</strong> |
81      -<strong>p</strong> |
82      -<strong>s</strong> ]
83    [ -<strong>t</strong> ]
84    [ -<strong>v</strong> ]
85    <var>username</var> <var>password</var></code></p>
86
87    <p><code><strong>htdbm</strong> -<strong>v</strong>
88    [ -<strong>T</strong><var>DBTYPE</var> ]
89    [ -<strong>c</strong> ]
90    [ -<strong>m</strong> |
91      -<strong>d</strong> |
92      -<strong>p</strong> |
93      -<strong>s</strong> ]
94    [ -<strong>t</strong> ]
95    [ -<strong>v</strong> ]
96    <var>filename</var> <var>username</var></code></p>
97
98    <p><code><strong>htdbm</strong> -<strong>vb</strong>
99    [ -<strong>T</strong><var>DBTYPE</var> ]
100    [ -<strong>c</strong> ]
101    [ -<strong>m</strong> |
102      -<strong>d</strong> |
103      -<strong>p</strong> |
104      -<strong>s</strong> ]
105    [ -<strong>t</strong> ]
106    [ -<strong>v</strong> ]
107    <var>filename</var> <var>username</var> <var>password</var></code></p>
108
109    <p><code><strong>htdbm</strong> -<strong>x</strong>
110    [ -<strong>T</strong><var>DBTYPE</var> ]
111    [ -<strong>m</strong> |
112      -<strong>d</strong> |
113      -<strong>p</strong> |
114      -<strong>s</strong> ]
115    <var>filename</var> <var>username</var></code></p>
116
117    <p><code><strong>htdbm</strong> -<strong>l</strong>
118    [ -<strong>T</strong><var>DBTYPE</var> ]
119    </code></p>
120</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
121<div class="section">
122<h2><a name="options" id="options">Options</a></h2>
123    <dl>
124    <dt><code>-b</code></dt>
125    <dd>Use batch mode; <em>i.e.</em>, get the password from the command line
126    rather than prompting for it. This option should be used with extreme care,
127    since <strong>the password is clearly visible</strong> on the command
128    line.</dd>
129
130    <dt><code>-c</code></dt>
131    <dd>Create the <var>passwdfile</var>. If <var>passwdfile</var> already
132    exists, it is rewritten and truncated. This option cannot be combined with
133    the <code>-n</code> option.</dd>
134
135    <dt><code>-n</code></dt>
136    <dd>Display the results on standard output rather than updating a
137    database.  This option changes the syntax of the command line, since the
138    <var>passwdfile</var> argument (usually the first one) is omitted. It
139    cannot be combined with the <code>-c</code> option.</dd>
140
141    <dt><code>-m</code></dt>
142    <dd>Use MD5 encryption for passwords. On Windows, Netware and TPF, this is
143    the default.</dd>
144
145    <dt><code>-d</code></dt>
146    <dd>Use <code>crypt()</code> encryption for passwords. The default on all
147    platforms but Windows, Netware and TPF. Though possibly supported by
148    <code>htdbm</code> on all platforms, it is not supported by the
149    <code class="program"><a href="/programs/httpd.html">httpd</a></code> server on Windows, Netware and TPF.</dd>
150
151    <dt><code>-s</code></dt>
152    <dd>Use SHA encryption for passwords. Facilitates migration from/to Netscape
153    servers using the LDAP Directory Interchange Format (ldif).</dd>
154
155    <dt><code>-p</code></dt>
156    <dd>Use plaintext passwords. Though <code>htdbm</code> will support
157    creation on all platforms, the <code class="program"><a href="/programs/httpd.html">httpd</a></code> daemon will
158    only accept plain text passwords on Windows, Netware and TPF.</dd>
159
160    <dt><code>-l</code></dt>
161    <dd>Print each of the usernames and comments from the database on
162    stdout.</dd>
163
164    <dt><code>-t</code></dt>
165    <dd>Interpret the final parameter as a comment.  When this option is
166    specified, an additional string can be appended to the command line; this
167    string will be stored in the "Comment" field of the database, associated
168    with the specified username.</dd>
169
170    <dt><code>-v</code></dt>
171    <dd>Verify the username and password.  The program will print a message
172    indicating whether the supplied password is valid.  If the password is
173    invalid, the program exits with error code 3.</dd>
174
175    <dt><code>-x</code></dt>
176    <dd>Delete user. If the username exists in the specified DBM file, it
177    will be deleted.</dd>
178
179    <dt><code><var>filename</var></code></dt>
180    <dd>The filename of the DBM format file. Usually without the extension
181    <code>.db</code>, <code>.pag</code>, or <code>.dir</code>.  If
182    <code>-c</code> is given, the DBM file is created if it does not already
183    exist, or updated if it does exist.</dd>
184
185    <dt><code><var>username</var></code></dt>
186    <dd>The username to create or update in <var>passwdfile</var>. If
187    <var>username</var> does not exist in this file, an entry is added. If it
188    does exist, the password is changed.</dd>
189
190    <dt><code><var>password</var></code></dt>
191    <dd>The plaintext password to be encrypted and stored in the DBM file.
192    Used only with the <code>-b</code> flag.</dd>
193
194    <dt><code>-T<var>DBTYPE</var></code></dt>
195    <dd>Type of DBM file (SDBM, GDBM, DB, or "default").</dd>
196    </dl>
197</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
198<div class="section">
199<h2><a name="bugs" id="bugs">Bugs</a></h2>
200    <p>One should be aware that there are a number of different DBM file
201    formats in existence, and with all likelihood, libraries for more than
202    one format may exist on your system. The three primary examples are
203    SDBM, NDBM, GNU GDBM, and Berkeley/Sleepycat DB 2/3/4. Unfortunately,
204    all these libraries use different file formats, and you must make sure
205    that the file format used by <var>filename</var> is the same format that
206    <code>htdbm</code> expects to see. <code>htdbm</code> currently has
207    no way of determining what type of DBM file it is looking at. If used
208    against the wrong format, will simply return nothing, or may create a
209    different DBM file with a different name, or at worst, it may corrupt
210    the DBM file if you were attempting to write to it.</p>
211
212    <p>One can usually use the <code>file</code> program supplied with most
213    Unix systems to see what format a DBM file is in.</p>
214</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
215<div class="section">
216<h2><a name="exit" id="exit">Exit Status</a></h2>
217    <p><code>htdbm</code> returns a zero status ("true") if the username and
218    password have been successfully added or updated in the DBM File.
219    <code>htdbm</code> returns <code>1</code> if it encounters some problem
220    accessing files, <code>2</code> if there was a syntax problem with the
221    command line, <code>3</code> if the password was entered interactively and
222    the verification entry didn't match, <code>4</code> if its operation was
223    interrupted, <code>5</code> if a value is too long (username, filename,
224    password, or final computed record), <code>6</code> if the username
225    contains illegal characters (see the <a href="#restrictions">Restrictions
226    section</a>), and <code>7</code> if the file is not a valid DBM password
227    file.</p>
228</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
229<div class="section">
230<h2><a name="examples" id="examples">Examples</a></h2>
231    <div class="example"><p><code>
232      htdbm /usr/local/etc/apache/.htdbm-users jsmith
233    </code></p></div>
234
235    <p>Adds or modifies the password for user <code>jsmith</code>. The user
236    is prompted for the password. If executed on a Windows system, the password
237    will be encrypted using the  modified Apache MD5 algorithm; otherwise, the
238    system's <code>crypt()</code> routine will be used. If the file does not
239    exist, <code>htdbm</code> will do nothing except return an error.</p>
240
241    <div class="example"><p><code>
242      htdbm -c /home/doe/public_html/.htdbm jane
243    </code></p></div>
244
245    <p>Creates a new file and stores a record in it for user <code>jane</code>.
246    The user is prompted for the password. If the file exists and cannot be
247    read, or cannot be written, it is not altered and <code>htdbm</code>
248    will display a message and return an error status.</p>
249
250    <div class="example"><p><code>
251      htdbm -mb /usr/web/.htdbm-all jones Pwd4Steve
252    </code></p></div>
253
254    <p>Encrypts the password from the command line (<code>Pwd4Steve</code>)
255    using the MD5 algorithm, and stores it in the specified file.</p>
256</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
257<div class="section">
258<h2><a name="security" id="security">Security Considerations</a></h2>
259    <p>Web password files such as those managed by <code>htdbm</code> should
260    <em>not</em> be within the Web server's URI space -- that is, they should
261    not be fetchable with a browser.</p>
262
263    <p>The use of the <code>-b</code> option is discouraged, since when it is
264    used the unencrypted password appears on the command line.</p>
265</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
266<div class="section">
267<h2><a name="restrictions" id="restrictions">Restrictions</a></h2>
268    <p>On the Windows and MPE platforms, passwords encrypted with
269    <code>htdbm</code> are limited to no more than <code>255</code>
270    characters in length. Longer passwords will be truncated to 255
271    characters.</p>
272
273    <p>The MD5 algorithm used by <code>htdbm</code> is specific to the Apache
274    software; passwords encrypted using it will not be usable with other Web
275    servers.</p>
276
277    <p>Usernames are limited to <code>255</code> bytes and may not include the
278    character <code>:</code>.</p>
279</div></div>
280<div class="bottomlang">
281<p><span>Available Languages: </span><a href="/en/programs/htdbm.html" title="English">&nbsp;en&nbsp;</a> |
282<a href="/tr/programs/htdbm.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
283</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
284<script type="text/javascript"><!--//--><![CDATA[//><!--
285var comments_shortname = 'httpd';
286var comments_identifier = 'http://httpd.apache.org/docs/2.2/programs/htdbm.html';
287(function(w, d) {
288    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
289        d.write('<div id="comments_thread"><\/div>');
290        var s = d.createElement('script');
291        s.type = 'text/javascript';
292        s.async = true;
293        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
294        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
295    }
296    else { 
297        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
298    }
299})(window, document);
300//--><!]]></script></div><div id="footer">
301<p class="apache">Copyright 2013 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
302<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
303if (typeof(prettyPrint) !== 'undefined') {
304    prettyPrint();
305}
306//--><!]]></script>
307</body></html>