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
8
<title>htpasswd - Manage user files for basic authentication - 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" />
12
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
13
<body id="manual-page"><div id="page-header">
14
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
15
<p class="apache">Apache HTTP Server Version 2.2</p>
16
<img alt="" src="../images/feather.gif" /></div>
17
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
19
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>htpasswd - Manage user files for basic authentication</h1>
21
<p><span>Available Languages: </span><a href="../en/programs/htpasswd.html" title="English"> en </a> |
22
<a href="../ko/programs/htpasswd.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
25
<p><code>htpasswd</code> is used to create and update the flat-files used to
26
store usernames and password for basic authentication of HTTP users. If
27
<code>htpasswd</code> cannot access a file, such as not being able to write
28
to the output file or not being able to read the file in order to update it,
29
it returns an error status and makes no changes.</p>
31
<p>Resources available from the Apache HTTP server can be restricted to
32
just the users listed in the files created by <code>htpasswd</code>. This
33
program can only manage usernames and passwords stored in a flat-file. It
34
can encrypt and display password information for use in other types of data
35
stores, though. To use a DBM database see <code class="program"><a href="../programs/dbmmanage.html">dbmmanage</a></code>.</p>
37
<p><code>htpasswd</code> encrypts passwords using either a version of MD5
38
modified for Apache, or the system's <code>crypt()</code> routine. Files
39
managed by <code>htpasswd</code> may contain both types of passwords; some
40
user records may have MD5-encrypted passwords while others in the same file
41
may have passwords encrypted with <code>crypt()</code>.</p>
43
<p>This manual page only lists the command line arguments. For details of
44
the directives necessary to configure user authentication in
45
<code class="program"><a href="../programs/httpd.html">httpd</a></code> see the Apache manual, which is part of the
46
Apache distribution or can be found at <a href="http://httpd.apache.org">http://httpd.apache.org/</a>.</p>
48
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
49
<li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
50
<li><img alt="" src="../images/down.gif" /> <a href="#exit">Exit Status</a></li>
51
<li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
52
<li><img alt="" src="../images/down.gif" /> <a href="#security">Security Considerations</a></li>
53
<li><img alt="" src="../images/down.gif" /> <a href="#restrictions">Restrictions</a></li>
54
</ul><h3>See also</h3><ul class="seealso"><li><code class="program"><a href="../programs/httpd.html">httpd</a></code></li><li>The scripts in support/SHA1 which come with the
55
distribution.</li></ul></div>
56
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
58
<h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
59
<p><code><strong>htpasswd</strong>
60
[ -<strong>c</strong> ]
61
[ -<strong>m</strong> ]
62
[ -<strong>D</strong> ] <var>passwdfile</var> <var>username</var></code></p>
64
<p><code><strong>htpasswd</strong> -<strong>b</strong>
65
[ -<strong>c</strong> ]
66
[ -<strong>m</strong> |
70
[ -<strong>D</strong> ] <var>passwdfile</var> <var>username</var>
71
<var>password</var></code></p>
73
<p><code><strong>htpasswd</strong> -<strong>n</strong>
74
[ -<strong>m</strong> |
77
-<strong>p</strong> ] <var>username</var></code></p>
79
<p><code><strong>htpasswd</strong> -<strong>nb</strong>
80
[ -<strong>m</strong> |
83
-<strong>p</strong> ] <var>username</var> <var>password</var></code></p>
84
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
86
<h2><a name="options" id="options">Options</a></h2>
88
<dt><code>-b</code></dt>
89
<dd>Use batch mode; <em>i.e.</em>, get the password from the command line
90
rather than prompting for it. This option should be used with extreme care,
91
since <strong>the password is clearly visible</strong> on the command
94
<dt><code>-c</code></dt>
95
<dd>Create the <var>passwdfile</var>. If <var>passwdfile</var> already
96
exists, it is rewritten and truncated. This option cannot be combined with
97
the <code>-n</code> option.</dd>
99
<dt><code>-n</code></dt>
100
<dd>Display the results on standard output rather than updating a file.
101
This is useful for generating password records acceptable to Apache for
102
inclusion in non-text data stores. This option changes the syntax of the
103
command line, since the <var>passwdfile</var> argument (usually the first
104
one) is omitted. It cannot be combined with the <code>-c</code> option.</dd>
106
<dt><code>-m</code></dt>
107
<dd>Use MD5 encryption for passwords. On Windows, Netware and TPF, this is
110
<dt><code>-d</code></dt>
111
<dd>Use <code>crypt()</code> encryption for passwords. The default on all
112
platforms but Windows, Netware and TPF. Though possibly supported by
113
<code>htpasswd</code> on all platforms, it is not supported by the
114
<code class="program"><a href="../programs/httpd.html">httpd</a></code> server on Windows, Netware and TPF.</dd>
116
<dt><code>-s</code></dt>
117
<dd>Use SHA encryption for passwords. Facilitates migration from/to Netscape
118
servers using the LDAP Directory Interchange Format (ldif).</dd>
120
<dt><code>-p</code></dt>
121
<dd>Use plaintext passwords. Though <code>htpasswd</code> will support
122
creation on all platforms, the <code class="program"><a href="../programs/httpd.html">httpd</a></code> daemon will
123
only accept plain text passwords on Windows, Netware and TPF.</dd>
125
<dt><code>-D</code></dt>
126
<dd>Delete user. If the username exists in the specified htpasswd file, it
127
will be deleted.</dd>
129
<dt><code><var>passwdfile</var></code></dt>
130
<dd>Name of the file to contain the user name and password. If
131
<code>-c</code> is given, this file is created if it does not already exist,
132
or rewritten and truncated if it does exist.</dd>
134
<dt><code><var>username</var></code></dt>
135
<dd>The username to create or update in <var>passwdfile</var>. If
136
<var>username</var> does not exist in this file, an entry is added. If it
137
does exist, the password is changed.</dd>
139
<dt><code><var>password</var></code></dt>
140
<dd>The plaintext password to be encrypted and stored in the file. Only
141
used with the <code>-b</code> flag.</dd>
143
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
144
<div class="section">
145
<h2><a name="exit" id="exit">Exit Status</a></h2>
146
<p><code>htpasswd</code> returns a zero status ("true") if the username and
147
password have been successfully added or updated in the
148
<var>passwdfile</var>. <code>htpasswd</code> returns <code>1</code> if it
149
encounters some problem accessing files, <code>2</code> if there was a
150
syntax problem with the command line, <code>3</code> if the password was
151
entered interactively and the verification entry didn't match,
152
<code>4</code> if its operation was interrupted, <code>5</code> if a value
153
is too long (username, filename, password, or final computed record),
154
<code>6</code> if the username contains illegal characters (see the
155
<a href="#restrictions">Restrictions section</a>), and <code>7</code>
156
if the file is not a valid password file.</p>
157
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
158
<div class="section">
159
<h2><a name="examples" id="examples">Examples</a></h2>
160
<div class="example"><p><code>
161
htpasswd /usr/local/etc/apache/.htpasswd-users jsmith
164
<p>Adds or modifies the password for user <code>jsmith</code>. The user
165
is prompted for the password. If executed on a Windows system, the password
166
will be encrypted using the modified Apache MD5 algorithm; otherwise, the
167
system's <code>crypt()</code> routine will be used. If the file does not
168
exist, <code>htpasswd</code> will do nothing except return an error.</p>
170
<div class="example"><p><code>
171
htpasswd -c /home/doe/public_html/.htpasswd jane
174
<p>Creates a new file and stores a record in it for user <code>jane</code>.
175
The user is prompted for the password. If the file exists and cannot be
176
read, or cannot be written, it is not altered and <code>htpasswd</code>
177
will display a message and return an error status.</p>
179
<div class="example"><p><code>
180
htpasswd -mb /usr/web/.htpasswd-all jones Pwd4Steve
183
<p>Encrypts the password from the command line (<code>Pwd4Steve</code>)
184
using the MD5 algorithm, and stores it in the specified file.</p>
185
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
186
<div class="section">
187
<h2><a name="security" id="security">Security Considerations</a></h2>
188
<p>Web password files such as those managed by <code>htpasswd</code> should
189
<em>not</em> be within the Web server's URI space -- that is, they should
190
not be fetchable with a browser.</p>
192
<p>The use of the <code>-b</code> option is discouraged, since when it is
193
used the unencrypted password appears on the command line.</p>
194
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
195
<div class="section">
196
<h2><a name="restrictions" id="restrictions">Restrictions</a></h2>
197
<p>On the Windows and MPE platforms, passwords encrypted with
198
<code>htpasswd</code> are limited to no more than <code>255</code>
199
characters in length. Longer passwords will be truncated to 255
202
<p>The MD5 algorithm used by <code>htpasswd</code> is specific to the Apache
203
software; passwords encrypted using it will not be usable with other Web
206
<p>Usernames are limited to <code>255</code> bytes and may not include the
207
character <code>:</code>.</p>
209
<div class="bottomlang">
210
<p><span>Available Languages: </span><a href="../en/programs/htpasswd.html" title="English"> en </a> |
211
<a href="../ko/programs/htpasswd.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
212
</div><div id="footer">
213
<p class="apache">Copyright 2006 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>
214
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
b'\\ No newline at end of file'