getfacl 命令和 Linux 文件权限 - 访问 Wordpress 时出现 403 错误

getfacl 命令和 Linux 文件权限 - 访问 Wordpress 时出现 403 错误

我正在为朋友配置 Wordpress,我刚刚使用 setfacl 搞砸了 Wordpress 目录权限(我怀疑)。Webfaction 不允许 sudo 或允许我使用 chown 更改目录组所有权。

现在看来,我所做的事情导致整个应用程序在我尝试访问时出现 403 错误。

当前目录列表如下所示(我暂时将整个目录设置为 777 以尝试恢复对它的访问权限):

drwxrwsr-x+  6 myusername myusername  4096 Mar  2 07:07 ./
drwxr-xr-x   3 root        root         4096 Feb 25 19:48 ../
-rwxrwxr-x+  1 myusername myusername   286 Mar  2 06:33 gzip.php
-rwxrwxr-x+  1 myusername myusername  4831 Mar  4 20:02 .htaccess
-rwxrwxr-x+  1 myusername myusername   397 Feb 25 19:49 index.php
-rw-rw-r--+  1 myusername myusername 15606 Feb 25 19:49 license.txt
-rw-rw-r--+  1 myusername myusername  9200 Feb 25 19:49 readme.html
drwxrwsr-x+  6 myusername myusername  4096 Feb 25 19:49 .svn/
-rwxrwxr-x+  1 myusername myusername  4337 Feb 25 19:49 wp-activate.php
drwxr-xr-x+ 10 myusername myusername  4096 Mar  4 20:03 wp-admin/
-rwxrwxr-x+  1 myusername myusername 40283 Feb 25 19:49 wp-app.php
-rwxrwxr-x+  1 myusername myusername   226 Feb 25 19:49 wp-atom.php
-rwxrwxr-x+  1 myusername myusername   274 Feb 25 19:49 wp-blog-header.php
-rwxrwxr-x+  1 myusername myusername  3931 Feb 25 19:49 wp-comments-post.php
-rwxrwxr-x+  1 myusername myusername   244 Feb 25 19:49 wp-commentsrss2.php
-rwxrwxr-x+  1 myusername myusername  3485 Feb 25 20:15 wp-config.php
drwxr-xr-x+  6 myusername myusername  4096 Feb 26 08:52 wp-content/
-rwxrwxr-x+  1 myusername myusername  1255 Feb 25 19:49 wp-cron.php
-rwxrwxr-x+  1 myusername myusername   246 Feb 25 19:49 wp-feed.php
drwxrwxr-x+  9 myusername myusername  4096 Feb 25 19:49 wp-includes/
-rwxrwxr-x+  1 myusername myusername  1997 Feb 25 19:49 wp-links-opml.php
-rwxrwxr-x+  1 myusername myusername  2453 Feb 25 19:49 wp-load.php
-rwxrwxr-x+  1 myusername myusername 27787 Feb 25 19:49 wp-login.php
-rwxrwxr-x+  1 myusername myusername  7774 Feb 25 19:49 wp-mail.php
-rwxrwxr-x+  1 myusername myusername   494 Feb 25 19:49 wp-pass.php
-rwxrwxr-x+  1 myusername myusername   224 Feb 25 19:49 wp-rdf.php
-rwxrwxr-x+  1 myusername myusername   334 Feb 25 19:49 wp-register.php
-rwxrwxr-x+  1 myusername myusername   226 Feb 25 19:49 wp-rss2.php
-rwxrwxr-x+  1 myusername myusername   224 Feb 25 19:49 wp-rss.php
-rwxrwxr-x+  1 myusername myusername  9655 Feb 25 19:49 wp-settings.php
-rwxrwxr-x+  1 myusername myusername 18644 Feb 25 19:49 wp-signup.php
-rwxrwxr-x+  1 myusername myusername  3702 Feb 25 19:49 wp-trackback.php
-rwxrwxr-x+  1 myusername myusername  3210 Feb 25 19:49 xmlrpc.php

getfacl 输出如下所示:

# file: .
# owner: myusername
# group: myusername
user::rwx
group::r-x
group:apache:rw-
mask::rwx
other::r-x

我只是想将所有权更改为 myusername:apache,并将文件权限更改为 755。我现在不知道如何修复权限。

任何帮助将非常感激!

谢谢,汤姆

答案1

getfacl说什么wp-content?Apache 有x权限(目录搜索/访问)吗?

如果没有,请尝试setfacl -R -m 'g:apache:rwX' .或类似方法。

或者使用 删除所有 ACL setfacl -Rb .

答案2

没有 webfaction...它是组 apache 还是您需要为用户 apache 添加权限?

他们的文件似乎表明用户apache 需要访问而不是组。所以也许:

执行 setfacl -R -mu:apache:rwx 即可。

man setfacl 应该告诉你更多信息

403 错误来源的另一种可能性是 .htaccess 文件的内容...如果不正确,那么 apache 可能会根据这些规则拒绝访问该目录。(看看今天是如何修改的)。

相关内容