linux - CentOS Subversion,基本授权密码文件不起作用

标签 linux apache svn centos .htpasswd

所以我安装了 SVN 并使用 HTTPD 作为远程存储库。一切正常,直到我使用密码文件。这根本不起作用。 Apache 的 error_log 说

(13) 权限被拒绝:无法打开密码文件

我已将 passwd 文件的 chmod 设置为 777 并将 chown 设置为 apache,我还将 repo 和 passwd 文件的父文件夹设置为 chown apache 和 chmod 777...

我不知道这怎么会是权限问题...请帮忙!!

更新

我去掉了 SVN,并在我的一个域上实现了标准的基本身份验证

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot "/var/www/www.domain.com/public_www"
    <Directory "/var/www/www.domain.com/public_www">
        Options -Indexes
        Order allow,deny
        Allow from all
        AllowOverride All
        AuthType Basic
        AuthName "Basic Authentication"
        AuthUserFile /path/to/authfile.htpasswd
        Require valid-user
    </Directory>
</VirtualHost>

我是这样创建密码文件的

htpasswd -cm /path/to/authfile.htpasswd username
password (and retype)

最后

service httpd restart

你瞧,身份验证提示像以前一样工作,但用户名和密码不工作!这相当令人沮丧,我已经仔细检查了密码文件和父文件夹的所有权限、所有者等,但我仍然得到

(13) Permission Denied: Could not open password file

在 Apache 的错误日志中

最佳答案

如果您使用的是 Red Hat Enterprise Linux/Centos/Fedora 系统,并且您在/var/www/html 目录之外创建了 htpasswd 文件,该目录属于 apache,您也会遇到 SELinux 上下文/标签的问题htpasswd 文件。您可以使用传递到 ls 命令的 -Z 选项检查 htpasswd 的当前上下文/标签。

ls -Z 

htpasswd 文件的类型应该是httpd_sys_content_t。你可以用这个命令改变它:

chcon -t httpd_sys_content_t htpasswd

有关为 SELinux 重新标记文件的更多信息:

https://wiki.centos.org/HowTos/SELinux#head-0f6390ddacfab39ee973ed8018a32212c2a02199

关于linux - CentOS Subversion,基本授权密码文件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13394558/

相关文章:

svn - VisualSVN Server 存储库是否与我将在 linux 上创建的 svn 存储库兼容?

linux - 无法理解 ftrace 输出

linux - 如何让 Selenium 在 GCP 中与 Jenkins2 一起工作

apache - 在 apache 中,如果我转到 https ://example. com,所有图像/链接都是 http ://. 有没有办法自动重写 html,所以它都是 https ://?

java - 在 Java 程序中使用 Apache Ant API 以编程方式构建源文件

bash - Bash 中的远程 URL 补全

c++ - C++ : How to correctly actualize a file against power loss?

php - 获取 Linux 上 PHP 任务消耗的 CPU %

php - 运行不断更新的脚本

svn - SVN外部文件没有提交正常吗?