由于路径的某个部分缺少搜索权限且之前的建议不起作用,因此权限被拒绝

由于路径的某个部分缺少搜索权限且之前的建议不起作用,因此权限被拒绝

我收到消息:

Permission denied because search permissions are missing on a component of the path.

在我已经为其设置别名的文档根目录之外的目录中httpd.conf,一直不知道如何获得授予的权限。

这个帖子让我走上了一些有趣的道路,但没有完整的解决方案。Redhat Linux 当前版本和 Apache 2.4。

这是我的httpd.conf文件:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

<Directory "/var/www/html">
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<Directory "/home/[redacted]/ssd_pdf/">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<IfModule alias_module>
    Alias /drawings/ /home/[username]/ssd_pdf/
</IfModule>

在我的浏览器位置栏中,我请求:

https://[domain]/drawings/[directory immediately under ssd_pdf]/[next directory down]/[file name].pdf

我明白了403 Forbidden

ssl_error_log显示消息:

[Fri Feb 09 19:30:12.712987 2018] [core:error] [pid 11512] (13)Permission denied: [client [my IP address]:18740] AH00035: access to /drawings/[directory immediately under ssd_pdf]/[next directory down]/[file name].pdf denied (filesystem path '/home/[/username]/ssd_pdf') because search permissions are missing on a component of the path

All files in [next directory down] have permissions -rw-rw-r--. and security context unconfined_u:object_r:httpd_sys_content_t:s0

All directories in [directory immediately under ssd_pdf] have permissions drwxrwxr-x. and context unconfined_u:object_r:httpd_sys_content_t:s0

All directories in ssd_pdf directory have permissions drwxrwxr-x. and context unconfined_u:object_r:httpd_sys_content_t:s0

ssd_pdf has permissions drwxrwxr-x. and context unconfined_u:object_r:httpd_sys_content_t:s0

The parent directory, which is the user's home directory and outside of the alias, expectedly has permissions drwx------. and context unconfined_u:object_r:user_home_dir_t:s0

为什么我会收到“禁止”错误消息?

答案1

你说:

父目录是用户的主目录,位于别名之外,预计具有权限 drwx------。和上下文 unconfined_u:object_r:user_home_dir_t:s0

为什么你说那是“别名之外”并不清楚。它显然是别名目录:

<IfModule alias_module>
    Alias /drawings/ /home/[username]/ssd_pdf/
</IfModule>

因此,由于该目录没有搜索权限,Apache 无法进入该目录。

您需要在此目录中至少设置 a+x(或 711)。

相关内容