【问题标题】:Changing the permission so the directory is world writable on CentOS 7更改权限,使目录在 CentOS 7 上是全局可写的
【发布时间】:2020-01-03 00:29:29
【问题描述】:

我在运行 CentOS 7 的 digitalocean VPS 上安装了 Xenforo,我一打开网页就收到此错误。 `验证您的服务器是否可以运行 XenForo 时出现以下错误:

The directory /var/www/html/data must be writable. Please change the permissions on this directory to be world writable (chmod 0777). If the directory does not exist, please create it.
The directory /var/www/html/internal_data must be writable. Please change the permissions on this directory to be world writable (chmod 0777). If the directory does not exist, please create it.
Please correct these errors and try again.

我将如何更改目录的权限,使其可以全局写入?

【问题讨论】:

  • 世界可写是非常不安全的。但这里是chmod 0777 /var/www/html/data /var/www/html/internal_data。您可能需要设置粘性位以减少不安全性。 chmod 1777 /var/www/html/data /var/www/html/internal_data.
  • 错误显示了您需要的命令,但我不建议运行它们。世界可写的东西通常是一个可怕的想法。
  • 如果它非常不安全,有什么办法可以继续使用 Xenforo?

标签: apache centos xenforo


【解决方案1】:

基本上datainternal_data 是运行Xenforo 的用户应该能够写入的目录,因为它们将包含附件、头像和其他文件。

通常在 Apache 或 Nginx 上运行 PHP 的用户是 www-data 在组 www-data 中(用户和组具有相同的名称),所以你所要做的就是让这个用户在 data 和 @ 上写987654326@:

chown -R www-data.www-data /var/www/html/data /var/www/html/internal_data

如果您想完全按照错误消息中给出的建议进行操作,您可以这样做:

chmod -R 0777 /var/www/html/data /var/www/html/internal_data

但正如其他人评论的那样,这种方法更不安全,因为它会允许系统中的任何用户写入datainternal_data 目录。

【讨论】:

    【解决方案2】:

    这是根据 CentMinMod 和 Xenforo documentation 在 CentOS 上的 nginx 上的 Xenforo 2 推荐的。必须这样做,否则 Xenforo2 将无法工作。我已经在多个站点上使用它没有问题。为了安全起见,请先备份。

    find /home/nginx/domains/domain.com/public/ -type f -print0 | xargs -0 chmod 0644;
    find /home/nginx/domains/domain.com/public/ -type d -print0 | xargs -0 chmod 0755;
    find /home/nginx/domains/domain.com/public/internal_data/ -type f -print0 | xargs -0 chmod 0777;
    find /home/nginx/domains/domain.com/public/data/ -type f -print0 | xargs -0 chmod 0777;
    find /home/nginx/domains/domain.com/public/internal_data/ -type d -print0 | xargs -0 chmod 0777;
    find /home/nginx/domains/domain.com/public/data/ -type d -print0 | xargs -0 chmod 0777;
    chmod 0750 /home/nginx/domains/domain.com/public;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-07
      • 1970-01-01
      • 2019-11-17
      • 2012-03-10
      • 1970-01-01
      • 2020-11-01
      • 2018-09-30
      • 2015-03-24
      相关资源
      最近更新 更多