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