.htaccess Apache 2.4“..身份验证失败..:密码不匹配”

vof42yt1  于 2023-02-05  发布在  Apache
关注(0)|答案(4)|浏览(225)

我在Windows Server 2008 R2中运行Apache 2.4。我尝试对子目录进行密码保护,并在Apache 2.0中成功执行了此操作。升级后,我听取了Apache的建议,并尝试将身份验证配置放入httpd. config中。我允许阅读密码文件,一切似乎正常,但在测试时,我收到以下错误:
[Mon 2013年4月1日19:58:36.438476] [授权_基本:错误] [pid 3984:tid 788] [客户端xxx.yyy.254.2:49253] AH 01617:主用户:“/restricted/ www.example.com“的身份验证失败file.zip:密码不匹配
不过,我知道我发送的是正确的密码。请参阅下面的配置,任何评论都是有帮助的。

<Directory "C:/www/mydir/restricted">
    #AllowOverride AuthConfig
    #Order allow,deny
    #Allow from all
    AuthType Basic
    AuthName Restricted
    AuthUserFile "C:/www/mydir/passwords/pass"
    Require valid-user
</Directory>  
<Directory "C:/www/mydir">
    Require all granted
</Directory>  
<VirtualHost *:80>
    ServerAdmin admin@.com
    DocumentRoot "C:/www/mydir"
    ServerName "fakeurl.com"
    ErrorLog "C:/www/mydir/logs/error.log"
    CustomLog "C:/www/mydir/logs/accesslog/access.log" common
</VirtualHost>  
<VirtualHost *:80>
    ServerAdmin admin@.com
    DocumentRoot "C:/www/mydir"
    ServerName "www.fakeurl.com"
    ErrorLog "C:/www/mydir/logs/error.log"
    CustomLog "C:/www/mydir/logs/accesslog/access.log" common
</VirtualHost>
eoigrqb6

eoigrqb61#

我刚刚遇到了同样的问题,在过去的一个小时里把我逼疯了。我可以确认Steve在命令行中输入密码的建议是有效的--所以在我的情况下,“B passwordfile用户密码”成功了。
Here是Apache中的相关错误报告。

qxsslcnc

qxsslcnc2#

您是否使用“htpasswd”创建密码?
httpd-2.4.4中的htpasswd已损坏(https://issues.apache.org/bugzilla/show_bug.cgi?id=54735)。
据我所知,这个问题是htpd-2.4.4中的htpasswd特有的,并且只有在手动输入密码时才会发生,因此您可以通过执行以下操作之一来解决这个问题:

  • 在命令行提供密码(例如“B .htpasswd用户密码”);
  • 使用httpd-2.4.3之外的htpasswd版本;
  • 使用摘要式身份验证代替基本身份验证(htdigest不受影响);
  • 等待httpd-2.4.5发布;
  • 应用bug报告中的补丁(看起来有效)并从源代码重新构建htpasswd。
juzqafwq

juzqafwq3#

如果您使用的是Shibboleth,mod_shib和基本身份验证之间会有冲突,您可以使用以下Apache指令来解决:

ShibCompatValidUser On

有关详细信息,请参见Shibboleth on Apache 2.4 Using Mixed Authentication Methods

m1m5dgzv

m1m5dgzv4#

我在Apache/2.4.6 (CentOS)上遇到了相同的情况
以上均未解决问题htpasswd的路径从$_SERVER['DOCUMENT_ROOT'];正确
好吧,也许有些人会发现它有帮助,我已经解决了:htpasswd -nb username newpassw > <path-to>/htpasswd
CentOS 7上Apache 2.4.6中的btw问题仍然存在

相关问题