-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhtpasswd.html
More file actions
360 lines (339 loc) · 11.1 KB
/
htpasswd.html
File metadata and controls
360 lines (339 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<!-- Creator : groff version 1.18.1 -->
<!-- CreationDate: Tue Dec 18 01:22:03 2007 -->
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta name="Content-Style" content="text/css">
<title>HTPASSWD</title>
</head>
<body>
<h1 align=center>HTPASSWD</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#SUMMARY">SUMMARY</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#EXIT STATUS">EXIT STATUS</a><br>
<a href="#EXAMPLES">EXAMPLES</a><br>
<a href="#SECURITY CONSIDERATIONS">SECURITY CONSIDERATIONS</a><br>
<a href="#RESTRICTIONS">RESTRICTIONS</a><br>
<hr>
<a name="NAME"></a>
<h2>NAME</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p>htpasswd − Manage user files for basic
authentication</p>
</td>
</table>
<a name="SYNOPSIS"></a>
<h2>SYNOPSIS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p><b>htpasswd</b> [ -<b>c</b> ] [ -<b>m</b> ] [ -<b>D</b> ]
<i>passwdfile username</i></p>
<!-- INDENTATION -->
<p><b>htpasswd</b> -<b>b</b> [ -<b>c</b> ] [ -<b>m</b> |
-<b>d</b> | -<b>p</b> | -<b>s</b> ] [ -<b>D</b> ]
<i>passwdfile username password</i></p>
<!-- INDENTATION -->
<p><b>htpasswd</b> -<b>n</b> [ -<b>m</b> | -<b>d</b> |
-<b>s</b> | -<b>p</b> ] <i>username</i></p>
<!-- INDENTATION -->
<p><b>htpasswd</b> -<b>nb</b> [ -<b>m</b> | -<b>d</b> |
-<b>s</b> | -<b>p</b> ] <i>username password</i></p>
</td>
</table>
<a name="SUMMARY"></a>
<h2>SUMMARY</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p>htpasswd is used to create and update the flat-files used
to store usernames and password for basic authentication of
HTTP users. If htpasswd cannot access a file, such as not
being able to write to the output file or not being able to
read the file in order to update it, it returns an error
status and makes no changes.</p>
<!-- INDENTATION -->
<p>Resources available from the Apache HTTP server can be
restricted to just the users listed in the files created by
htpasswd. This program can only manage usernames and
passwords stored in a flat-file. It can encrypt and display
password information for use in other types of data stores,
though. To use a DBM database see dbmmanage.</p>
<!-- INDENTATION -->
<p>htpasswd encrypts passwords using either a version of MD5
modified for Apache, or the system’s crypt() routine.
Files managed by htpasswd may contain both types of
passwords; some user records may have MD5-encrypted
passwords while others in the same file may have passwords
encrypted with crypt().</p>
<!-- INDENTATION -->
<p>This manual page only lists the command line arguments.
For details of the directives necessary to configure user
authentication in httpd see the Apache manual, which is part
of the Apache distribution or can be found at
http://httpd.apache.org/.</p>
</td>
</table>
<a name="OPTIONS"></a>
<h2>OPTIONS</h2>
<!-- TABS -->
<table width="100%" border=0 rules="none" frame="void"
cols="4" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-b</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Use batch mode; <i>i.e.</i>, get the password from the
command line rather than prompting for it. This option
should be used with extreme care, since <b>the password is
clearly visible</b> on the command line.</p>
</td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-c</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Create the <i>passwdfile</i>. If <i>passwdfile</i>
already exists, it is rewritten and truncated. This option
cannot be combined with the -n option.</p>
</td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-n</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Display the results on standard output rather than
updating a file. This is useful for generating password
records acceptable to Apache for inclusion in non-text data
stores. This option changes the syntax of the command line,
since the <i>passwdfile</i> argument (usually the first one)
is omitted. It cannot be combined with the -c option.</p>
</td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-m</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Use MD5 encryption for passwords. On Windows, Netware
and TPF, this is the default.</p>
</td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-d</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Use crypt() encryption for passwords. The default on all
platforms but Windows, Netware and TPF. Though possibly
supported by htpasswd on all platforms, it is not supported
by the httpd server on Windows, Netware and TPF.</p>
</td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-s</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Use SHA encryption for passwords. Facilitates migration
from/to Netscape servers using the LDAP Directory
Interchange Format (ldif).</p>
</td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-p</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Use plaintext passwords. Though htpasswd will support
creation on all platforms, the httpd daemon will only accept
plain text passwords on Windows, Netware and TPF.</p>
</td>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
<p>-D</p>
</td>
<td width="5%"></td>
<td width="77%">
<p>Delete user. If the username exists in the specified
htpasswd file, it will be deleted.</p>
</td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p><i>passwdfile</i></p></td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="21%"></td>
<td width="77%">
<p>Name of the file to contain the user name and password.
If -c is given, this file is created if it does not already
exist, or rewritten and truncated if it does exist.</p>
</td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p><i>username</i></p></td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="21%"></td>
<td width="77%">
<p>The username to create or update in <i>passwdfile</i>. If
<i>username</i> does not exist in this file, an entry is
added. If it does exist, the password is changed.</p>
</td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p><i>password</i></p></td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="21%"></td>
<td width="77%">
<p>The plaintext password to be encrypted and stored in the
file. Only used with the -b flag.</p>
</td>
</table>
<a name="EXIT STATUS"></a>
<h2>EXIT STATUS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p>htpasswd returns a zero status ("true") if the
username and password have been successfully added or
updated in the <i>passwdfile</i>. htpasswd returns 1 if it
encounters some problem accessing files, 2 if there was a
syntax problem with the command line, 3 if the password was
entered interactively and the verification entry
didn’t match, 4 if its operation was interrupted, 5 if
a value is too long (username, filename, password, or final
computed record), 6 if the username contains illegal
characters (see the Restrictions section), and 7 if the file
is not a valid password file.</p>
</td>
</table>
<a name="EXAMPLES"></a>
<h2>EXAMPLES</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<pre> htpasswd /usr/local/etc/apache/.htpasswd-users jsmith
</pre>
<!-- INDENTATION -->
<p>Adds or modifies the password for user jsmith. The user
is prompted for the password. If executed on a Windows
system, the password will be encrypted using the modified
Apache MD5 algorithm; otherwise, the system’s crypt()
routine will be used. If the file does not exist, htpasswd
will do nothing except return an error.</p>
<!-- INDENTATION -->
<pre> htpasswd -c /home/doe/public_html/.htpasswd jane
</pre>
<!-- INDENTATION -->
<p>Creates a new file and stores a record in it for user
jane. The user is prompted for the password. If the file
exists and cannot be read, or cannot be written, it is not
altered and htpasswd will display a message and return an
error status.</p>
<!-- INDENTATION -->
<pre> htpasswd -mb /usr/web/.htpasswd-all jones Pwd4Steve
</pre>
<!-- INDENTATION -->
<p>Encrypts the password from the command line (Pwd4Steve)
using the MD5 algorithm, and stores it in the specified
file.</p>
</td>
</table>
<a name="SECURITY CONSIDERATIONS"></a>
<h2>SECURITY CONSIDERATIONS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p>Web password files such as those managed by htpasswd
should <i>not</i> be within the Web server’s URI space
-- that is, they should not be fetchable with a browser.</p>
<!-- INDENTATION -->
<p>The use of the -b option is discouraged, since when it is
used the unencrypted password appears on the command
line.</p>
</td>
</table>
<a name="RESTRICTIONS"></a>
<h2>RESTRICTIONS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="89%">
<p>On the Windows and MPE platforms, passwords encrypted
with htpasswd are limited to no more than 255 characters in
length. Longer passwords will be truncated to 255
characters.</p>
<!-- INDENTATION -->
<p>The MD5 algorithm used by htpasswd is specific to the
Apache software; passwords encrypted using it will not be
usable with other Web servers.</p>
<!-- INDENTATION -->
<p>Usernames are limited to 255 bytes and may not include
the character :.</p>
</td>
</table>
<hr>
<a rel="bookmark" href="http://www.askapache.com/" title="Web Development, Programming, Web Design, Security, Web Hosting and Apache .htaccess, Server Articles">AskApache Web Development</a></body>
</html>