⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_authn_file.html

📁 这个是我在web培训时老师提供的手册
💻 HTML
字号:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="Apache, 中文, 手册, 中文版, 中文手册, 中文版手册, 参考手册, 中文参考手册, 金步国" />
<meta name="description" content="Apache 2.2 中文版参考手册" />
<meta name="author" content="金步国" />
<link href="../style/css/manual-zip.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-zip-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<title>mod_authn_file - Apache 2.2 中文版参考手册</title>
</head>
<body><div id="page-header">
<p class="menu"><a href="../mod/index.html">模块索引</a> | <a href="../mod/directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p><p class="apache">Apache HTTP Server 版本2.2</p><img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./index.html"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path"><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/">文档</a> &gt; <a href="../index.html">版本2.2</a> &gt; <a href="./index.html">模块</a></div>

<div id="translation-info">   <a href="../translator_announcement.html#thanks">致谢</a> | <a href="../translator_announcement.html#announcement">译者声明</a> | 本篇译者:<a href="mailto:&#099;sfr&#0097;nk&#0064;&#099;itiz&#046;n&#0101;t">金步国</a> | 本篇译稿最后更新:2006年1月24日 | <a href="../translator_announcement.html#last_new">获取最新版本</a></div>
<div id="page-content"><div id="preamble"><h1>Apache模块 mod_authn_file</h1>

<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="module">
<tr><th><a href="module-dict.html#Description">说明</a></th><td>使用纯文本文件为认证提供支持</td></tr>
<tr><th><a href="module-dict.html#Status">状态</a></th><td>基本(B)</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">模块名</a></th><td>authn_file_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">源文件</a></th><td>mod_authn_file.c</td></tr>
<tr><th><a href="module-dict.html#Compatibility">兼容性</a></th><td>仅在 Apache 2.1 及以后的版本中可用</td></tr>
</table>
<h3>概述</h3>

    <p>该模块为认证前端(<code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code>和<code class="module"><a href="../mod/mod_auth_basic.html">mod_auth_basic</a></code>)使用纯文本文件进行用户认证提供支持。<code class="module"><a href="../mod/mod_authn_dbm.html">mod_authn_dbm</a></code>模块也提供类似的功能。</p>

    <p>使用<code class="module"><a href="../mod/mod_auth_basic.html">mod_auth_basic</a></code>或<code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code>的时候,可以通过在<code class="directive"><a href="../mod/mod_auth_basic.html#authbasicprovider">AuthBasicProvider</a></code>或<code class="directive"><a href="../mod/mod_auth_digest.html#authdigestprovider">AuthDigestProvider</a></code>指令中使用<code>file</code>值调用该模块。</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="AuthUserFile" id="AuthUserFile">AuthUserFile</a> <a name="authuserfile" id="authuserfile">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>设定一个含有认证使用的用户名/密码列表的纯文本文件</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>AuthUserFile <var>file-path</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">覆盖项</a></th><td>AuthConfig</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>基本(B)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_authn_file</td></tr>
</table>
    <p><code class="directive">AuthUserFile</code>指令设定一个纯文本文件的名称,其中包含用于认证的用户名/密码的列表,<var>File-path</var>是该文件的路径。如果不是绝对路径(也就是说,如果不是以斜杠开始的),则是相对于<code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>的相对路径。</p>

    <p>用户文件的每一行包含一个用户名,后跟一个冒号,再跟一个加密过的密码。如果文件中含有重复的用户名,<code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code>模块会用排在最前面的那行定义来验证该用户的密码。</p>

    <p>在二进制文件安装包中附带的(或者在"<code>src/support</code>"中)命令行工具<code class="program"><a href="../programs/htpasswd.html">htpasswd</a></code>可以用来维护<em>仅用于HTTP基本认证</em>的密码文件。参阅<a href="../programs/htpasswd.html">手册页面</a>以获得更详细的说明。</p>

    <p>以一个初始帐户<code>username</code>创建一个密码文件<code>Filename</code> 。它会提示输入密码:</p>

    <div class="example"><p><code>
      htpasswd -c Filename username
    </code></p></div>

    <p>增加或修改密码文件<code>Filename</code>中的帐号<code>username2</code> :</p>

    <div class="example"><p><code>
      htpasswd Filename username2
    </code></p></div>

    <p>注意:搜索很大的文本文件是<em>非常慢</em>的;应该使用<code class="directive"><a href="../mod/mod_authn_dbm.html#authdbmuserfile">AuthDBMUserFile</a></code>来替代它。</p>

    <p>如果使用<em>HTTP摘要认证</em>,就不能使用<code class="program"><a href="../programs/htpasswd.html">htpasswd</a></code>工具,而要使用<code class="program"><a href="../programs/htdigest.html">htdigest</a></code>工具。注意:不能在同一个文件中同时包含用于基本认证和摘要认证的用户数据。</p>

    <div class="warning"><h3>安全</h3>
      <p>必须确保<code class="directive">AuthUserFile</code>文件存放在WEB服务器目录之外,千万不要放在它所保护的目录中,否则可能会被客户端下载。</p>
    </div>

</div>
</div>
<div id="footer">
<p class="apache">本文允许自由使用、分发、转载,但必须保留译者署名;详见:<a href="../translator_announcement.html#announcement">译者声明</a>。</p>
<p class="menu"><a href="../mod/index.html">模块索引</a> | <a href="../mod/directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p></div>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -