AuthUserFile 不起作用,可能出了什么问题?
我使用的是CentOS 我昨晚换了服务器。 我的 AuthUserFile
文件有问题。
我总是被封锁。 我确定:
该路径是真实路径:
AuthUserFile /home/rootvideo/.htpasswd
/home/rootvideo/.htpasswd
和.htaccess
文件有0644< /code> 权限。
httpd.conf
在所有文件夹中设置为AllowOverride All
。所有
mod_auth
均已加载。LoadModule authn_file_module 模块/mod_authn_file.so LoadModule authn_alias_module 模块/mod_authn_alias.so LoadModule authn_anon_module 模块/mod_authn_anon.so LoadModule authn_dbm_module 模块/mod_authn_dbm.so LoadModule authn_default_module 模块/mod_authn_default.so LoadModule authnz_ldap_module 模块/mod_authnz_ldap.so
有什么想法吗?
I'm using CentOS
and I switched servers last night.
I'm having a problem with the AuthUserFile
file.
I always get blocked.
I made sure that:
The path is the real path:
AuthUserFile /home/rootvideo/.htpasswd
The
/home/rootvideo/.htpasswd
and.htaccess
file has0644
permissions.httpd.conf
is set toAllowOverride All
in all of the folders.All the
mod_auth
are loaded.LoadModule authn_file_module modules/mod_authn_file.so LoadModule authn_alias_module modules/mod_authn_alias.so LoadModule authn_anon_module modules/mod_authn_anon.so LoadModule authn_dbm_module modules/mod_authn_dbm.so LoadModule authn_default_module modules/mod_authn_default.so LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
供将来参考:
将文件chmodd到0660的父目录到0755,文件的所有者应该是apache用户。对于 Debian 变体 (ubuntu),这是 www-data。对于 CentOS 来说是 apache。
查找您需要的用户:
For future reference :
Chmodd the file to 0660 the parent directory to 0755 and the owner of the file should be the apache user. For debian variants (ubuntu) this is www-data. For CentOS its apache.
Finding what user you need :
只需在这里添加我对这个问题的经验。就我而言,我正在使用启用了 SELinux 的最新 Centos 服务器。即使所有权限都按照应有的方式设置,我的 .htpasswd 文件上仍出现权限被拒绝错误。
我最终只是禁用了 SELinux,因为它只是一个内部服务器,但最好的解决方案当然是更改 SELinux 设置以允许 apache web 用户读取该文件。
Just have to add my experience here with this issue. In my case I was working on a recent Centos server that had SELinux enabled. I was getting permissions denied errors on my .htpasswd file even though all the permissions were set like they should.
I ended up just disabling SELinux, as it was an internal server only, but the best solution is ofcourse change the SELinux setup to allow read access to this file for the apache webuser.
我刚刚遇到了同样的问题。就我而言,我犯了一个拼写错误,在配置中写了 AuthType 而不是 AuthName。因此,AuthType 被无效值覆盖。对于遇到此问题的其他人,值得仔细检查您的 conf 文件中是否有任何不正确的 AuthType 指令。
I just encountered the same issue. In my case, I had made a typo and written AuthType instead of AuthName in my configuration. The AuthType was thus overriden by an invalid value. For others who encounter this it's worth double checking whether you have any incorrect AuthType directives in your conf file.
我有同样的问题,我的问题来自“隐形角色”。
我已经删除了整行
AuthUserFile
,并再次写入(这一次,不是复制粘贴)并且它已修复!I had the same issue, and my issue was from an "invisible character".
I've deleted the whole line of
AuthUserFile
, and wrote again (this time, not copy pasting) and it's fixed!对于我来说,问题是我在该部分中有
Require all granted
,导致目录不受任何密码保护。删除它后,密码验证就可以工作了。
注意:我在 ubuntu 上的 apache2 2.4.7 上使用 WebDAV 和密码身份验证
For my the problem was that I had
Require all granted
in the section resulting in the directory was not proteced with any password.After removing it the password authentication works.
Note: I was using WebDAV together with password authentication on apache2 2.4.7 on ubuntu