Sal*_*Sal 22 linux permissions chmod
我在设置一些 WordPress 主题时正在调整权限,并运行chmod 664 -R theme-dir/*它在目录根目录中的文件上运行良好,但是当我执行以下操作时,子目录中的所有文件现在都这样读取ls -l:
?--------- ? ? ? ? ? core_functions.php
?--------- ? ? ? ? ? css
?--------- ? ? ? ? ? custom_functions.php
?--------- ? ? ? ? ? images
?--------- ? ? ? ? ? import_settings.php
?--------- ? ? ? ? ? js
?--------- ? ? ? ? ? options_trim.php
?--------- ? ? ? ? ? page_templates
?--------- ? ? ? ? ? post_thumbnails_trim.php
?---------+ ? ? ? ? ? shortcodes
Run Code Online (Sandbox Code Playgroud)
我无法 cd 到任何子目录,也无法删除它们。我从来没有见过这样的事情,有人遇到过类似的事情吗?
Kev*_*art 49
访问目录的内容(或更具体地说,除文件名之外的文件元数据)要求该目录设置了执行位。
您的递归 chmod 删除了该权限,因此您失去了该访问权限。如果您使用的是-R选项,chmod最好避免使用权限的数字版本,而是运行(以您想要的状态为例)chmod -R ug=rwX,o=rX。那里的大写 X 表示仅在至少具有一x组的目录或文件上设置 X 位。此外,您可能希望使用 644 ( u=rwX,go=rX) ,除非您确实需要组用户来编写。
ben*_*tek 14
如果您对服务器具有 shell 访问权限,则可以使用以下命令递归更改文件权限:
对于目录:
find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;
Run Code Online (Sandbox Code Playgroud)
对于文件:
find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;
Run Code Online (Sandbox Code Playgroud)