Post by account_disabled on Dec 12, 2023 22:43:57 GMT -6
您是否正在尝试找出文件和文件夹的正确 WordPress 权限?或者您对 WordPress 权限有点困惑? WordPress 文件权限对于网站的安全和功能至关重要,因此您需要充分了解它们。如果您有 WordPress 托管,您的主机几乎肯定已经为您配置了权限,但了解这些概念仍然很有帮助,以防您遇到某些情况麻烦。 因此,如果您从未听说过文件权限,或者您只是在寻找正确的 WordPress 文件权限,请阅读这篇文章。如果您已经熟悉文件权限,可以点击第二个链接直接跳转到WordPress的最佳文件权限。 信息 这篇文章 100% 专注于 WordPress 文件权限以及如何使用它们来保护您的网站。如果您对控制 WordPress 用户权限更感兴趣,请查看我们关于 WordPress 用户角色和功能的文章。 什么是文件权限? 简单地说,文件权限决定了不同用户如何与 WordPress 网站服务器上的文件进行交互。更具体地说,文件权限控制谁可以读取、写入和文件:执行 读取:读取文件内容的能力。 写入:更改文件的能力。 执行:“使用”文件的能力(例如执行脚本)。
用户是谁? 用户分为三种不同的“类型”: 所有者: 是文件或目录的 电话号码清单 指定所有者。 组:是拥有该文件或目录的组的成员。 公开:除文件所有者或群组成员之外的所有用户。 每个文件或文件夹都由特定用户或特定组拥有。每个用户可以是多个组的成员,但只能有一个主要组。 例如,当您通过 SFTP 连接到您的网站时,您正在使用服务器上的用户帐户,并且该用户帐户属于一个或多个组,具体取决于服务器配置。 注意: 大多数人不需要理解“用户”的概念,因为您的主机负责配置。但是,了解用户对于了解文件权限的工作原理至关重要。如果您在本节中感到有点迷失,请注意,在大多数情况下,您的主机已经为您的服务器环境正确配置了用户。 通过文件权限,您可以控制每种类型的用户(所有者、组、公共)可以对服务器上的文件和文件夹执行哪些操作(读取、写入、执行)。 一般来说,文件所有者应该拥有最多的权限;属于同一组的用户应具有相同或不同的权限;公共用户应具有与组相同或更少的权限: 业主民众 文件权限的想法与 WordPress 角色和功能系统非常相似。
如果您是网站的管理员,那么您比编辑者拥有更多的控制权。例如,管理员可以安装新插件,但编辑者不能这样做。 同样,编辑者比网站的匿名访问者拥有更多的控制权,尽管编辑者没有管理员那么大的权力。例如,编辑可以编辑其他人的博客文章并发布新文章,但编辑不能安装新插件。 文件权限中的数字是什么意思? 文件权限由称为权限模式的三位数表示。440, 数字的每一位对应于特定用户可以执行的操作: 第一位数字:控制所有者可以执行的操作。 第二位数字: 控制用户的组中的用户帐户可以执行哪些操作。群组 a> 第三位数字:控制其他人可以执行的操作(公开)。 权限模式的每一位数字都是分配给每个操作的数字之和: 阅读: 4 写入:2 执行: 1 如果您不想授予任何权限,请使用数字0。 正如已经提到的,您在权限模式中看到的数字是一个实体的所有权限的总和。例如,如果所有者可以阅读 (4) 并且(4+2)。 6(2),权限模式为write 或者,如果所有者拥有全部三种权限,则权限模式为7 (4+2+1)。 因此,777 是最宽松的配置。这意味着: 第一个数字 – 7 – 所有者可以读取 您几乎不需要在 WordPress 网站上设置任何权限777。我们稍后再讨论。 如果您想玩得开心,可以使用chmod 计算器来查看当您为不同的角色分配不同的权限时数字如何变化。用户。 文件权限中的字母是什么意思? 虽然您可能最常遇到数字格式,但有时您也会看到由字母和连字符表示的文件权限。
用户是谁? 用户分为三种不同的“类型”: 所有者: 是文件或目录的 电话号码清单 指定所有者。 组:是拥有该文件或目录的组的成员。 公开:除文件所有者或群组成员之外的所有用户。 每个文件或文件夹都由特定用户或特定组拥有。每个用户可以是多个组的成员,但只能有一个主要组。 例如,当您通过 SFTP 连接到您的网站时,您正在使用服务器上的用户帐户,并且该用户帐户属于一个或多个组,具体取决于服务器配置。 注意: 大多数人不需要理解“用户”的概念,因为您的主机负责配置。但是,了解用户对于了解文件权限的工作原理至关重要。如果您在本节中感到有点迷失,请注意,在大多数情况下,您的主机已经为您的服务器环境正确配置了用户。 通过文件权限,您可以控制每种类型的用户(所有者、组、公共)可以对服务器上的文件和文件夹执行哪些操作(读取、写入、执行)。 一般来说,文件所有者应该拥有最多的权限;属于同一组的用户应具有相同或不同的权限;公共用户应具有与组相同或更少的权限: 业主民众 文件权限的想法与 WordPress 角色和功能系统非常相似。
如果您是网站的管理员,那么您比编辑者拥有更多的控制权。例如,管理员可以安装新插件,但编辑者不能这样做。 同样,编辑者比网站的匿名访问者拥有更多的控制权,尽管编辑者没有管理员那么大的权力。例如,编辑可以编辑其他人的博客文章并发布新文章,但编辑不能安装新插件。 文件权限中的数字是什么意思? 文件权限由称为权限模式的三位数表示。440, 数字的每一位对应于特定用户可以执行的操作: 第一位数字:控制所有者可以执行的操作。 第二位数字: 控制用户的组中的用户帐户可以执行哪些操作。群组 a> 第三位数字:控制其他人可以执行的操作(公开)。 权限模式的每一位数字都是分配给每个操作的数字之和: 阅读: 4 写入:2 执行: 1 如果您不想授予任何权限,请使用数字0。 正如已经提到的,您在权限模式中看到的数字是一个实体的所有权限的总和。例如,如果所有者可以阅读 (4) 并且(4+2)。 6(2),权限模式为write 或者,如果所有者拥有全部三种权限,则权限模式为7 (4+2+1)。 因此,777 是最宽松的配置。这意味着: 第一个数字 – 7 – 所有者可以读取 您几乎不需要在 WordPress 网站上设置任何权限777。我们稍后再讨论。 如果您想玩得开心,可以使用chmod 计算器来查看当您为不同的角色分配不同的权限时数字如何变化。用户。 文件权限中的字母是什么意思? 虽然您可能最常遇到数字格式,但有时您也会看到由字母和连字符表示的文件权限。