简体   繁体   English

Wordpress 文件对 Linux 的权限

[英]Wordpress files' permissions on Linux

I am running a Wordpress installation with Docker (apache) on Linux.我在 Linux 上运行 Wordpress 安装和 Docker (apache)。
I set the ownership of my Wordpress folder and files to www-data:www-data , or 33:33 (otherwise, I couldn't install plugins or update wordpress from the WP dashboard. I found this solution in many tutorials.)我将 Wordpress 文件夹和文件的所有权设置为www-data:www-data或 33:33(否则,我无法从 WP 仪表板安装插件或更新 wordpress。我在许多教程中都找到了这个解决方案。)
But because I changed the ownership to www-data, I don't have direct access anymore to the.php files in those folders (so I can't edit them with VS code, or simply modify them in the linux file explorer).但是因为我将所有权更改为 www-data,我无法再直接访问这些文件夹中的 .php 文件(因此我无法使用 VS 代码编辑它们,或者只是在 linux 文件资源管理器中修改它们)。 How can I fix this?我怎样才能解决这个问题?

What I tried:我尝试了什么:
I tried to add myself to the www-data group, but when I run 'groups' in the terminal, I get "myself adm cdrom sudo dip plugdev lpadmin lxd sambashare docker".我试图将自己添加到 www-data 组,但是当我在终端中运行“组”时,我得到“我自己的 adm cdrom sudo dip plugdev lpadmin lxd sambashare docker”。 I don't see www-data.我没有看到 www 数据。 When I run "grep ^www-data /etc/group", I see "www-data:x:33:myself" though.当我运行“grep ^www-data /etc/group”时,我看到了“www-data:x:33:myself”。 Weird.诡异的。
I found a similar question here with a suggested solution to do "sudo chown user:www-data -R" on my WordPress folder, but if I do that, I'm back at the beginning where I cannot add themes, plugins or update wordpress from the WP Dashboard.我在这里发现了一个类似的问题,建议的解决方案是在我的 WordPress 文件夹上执行“sudo chown user:www-data -R”,但如果我这样做,我会回到无法添加主题、插件或更新的开头来自 WP 仪表板的 wordpress。

在此处输入图像描述

After restarting Linux, my user was finally added to the www-data group (now I could see me as part of this group when typing 'groups' in the console).重新启动 Linux 后,我的用户终于被添加到 www-data 组(现在在控制台中输入“组”时,我可以看到我是该组的一部分)。 I then went to add the writing permissions to the www-data group on those Wordpress files, and now, everything is fixed.然后,我将这些 Wordpress 文件的写入权限添加到 www-data 组,现在,一切都已修复。 Thanks for the advice ebvjr and Joni: :)感谢 ebvjr 和 Joni 的建议::)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM