【问题标题】:What permissions should a wordpress installation have to be secure but functional?wordpress 安装必须具有哪些权限才能安全但功能正常?
【发布时间】:2012-10-01 09:45:24
【问题描述】:

我已经阅读了http://codex.wordpress.org/Hardening_WordPress,但我无法理解它。应设置哪些权限以及由谁拥有?现在我已经设置为以下命令的结果:

# reset to safe defaults
find /usr/share/wordpress -exec chown www-data:www-data {} \;
find /usr/share/wordpress -type d -exec chmod 755 {} \;
find /usr/share/wordpress -type f -exec chmod 644 {} \;

# allow wordpress to manage wp-config.php (but prevent world access)
chgrp www-data /usr/share/wordpress/wp-config.php
chmod 660 /usr/share/wordpress/wp-config.php

# allow wordpress to manage .htaccess
chgrp www-data /usr/share/wordpress/.htaccess
chmod 664 /usr/share/wordpress/.htaccess

# allow wordpress to manage wp-content
find /usr/share/wordpress/wp-content -exec chgrp www-data {} \;
find /usr/share/wordpress/wp-content -type d -exec chmod 775 {} \;
find /usr/share/wordpress/wp-content -type f -exec chmod 664 {} \;

在此配置后,安装将无法使用。有什么建议吗?

【问题讨论】:

  • 您是在 ubuntu 中使用自己的服务器还是使用虚拟主机站点?

标签: wordpress security ubuntu permissions


【解决方案1】:

以下是我如何管理服务器权限的简要回顾:

  • 任何人都可以读取文件和目录
  • 没有人可以在 /wp-content/uploads 目录之外写任何东西
  • PHP 脚本不能在 /wp-content/uploads 目录中执行
  • PHP 脚本不能直接在 /wp-includes 和 /wp-content 中执行

因此,谁拥有 .php 文件并不重要,只要 apache 用户可以读取它们即可。允许 apache 用户修改这些文件是有风险的,即使是 .htaccess。所有这些的缺点是您需要为 WordPress 提供 FTP 凭据来执行诸如安装或删除插件、更新主题或核心等操作。这是我可以忍受的。

【讨论】:

  • 感谢您的回答!我现在注意到我之前使用的脚本在我再次运行时确实有效,我上次一定做错了什么。我仍然会选择你的问题作为接受的答案:)
猜你喜欢
  • 2021-07-24
  • 1970-01-01
  • 2017-03-03
  • 1970-01-01
  • 1970-01-01
  • 2015-02-21
  • 2021-02-24
  • 2021-09-08
  • 1970-01-01
相关资源
最近更新 更多