一个一般的 linux 文件权限问题:Apache 和 WordPress [英] A general linux file permissions question: Apache and WordPress
问题描述
几周前我从共享主机转移到 VPS,我遇到了这些烦人的 WordPress 权限问题.你知道你可以从管理面板下载和升级插件(和 wordpress 本身),但是自从我移动它开始询问我的 FTP 凭据,当我必须更新大约 20 个插件时这有点慢.
我认为这应该是某种权利问题.我查看了共享托管wordpress文件,它们都属于用户名和组kovshenin(kovshenin:kovshenin),文件是-rw-r--r--,目录是drwx-r-xr-x.>
在我的 VPS 上,apache 在 apache:apache 下运行,我的文件是 kovshenin:kovshenin.我应该怎么做才能使 kovshenin 和 apache 都可读可写?
此外,我将 wordpress 安装的所有文件和文件夹的权限更改为 0777,这允许我在没有 FTP 的情况下安装和删除插件,但是当我推送到自动升级到 WordPress 2.8.1 时,它仍然要求我提供我的FTP 帐户.这是 wp 问题还是我错过了什么?
谢谢.
更新:我设法在 MediaTemple 共享主机上运行 id
和 id www-data
.用户 kovshenin 在 kovshenin 组中,www-data 在 www-data 组中.没有更多的团体.有什么诀窍?
另一个更新 好的,我将 apache
用户添加到 kovshenin
组,我的 wordpress 文件是 kovshenin:kovshenin
对目录具有 rw-rw-r--
权限和 drwxrwxr-x
权限,但仍然有问题.用户 apache
可以访问文件和文件夹,我可以使用 wordpress 管理面板中的在线主题和插件编辑器,我可以从 wordpress 中更改 .htaccess 文件,但是插件/theme 安装仍然要求我提供 FTP 凭据!
有什么想法吗?谢谢.
我应该怎么做才能让 kovshenin 和 apache 都可读可写?
- 创建一个新组,说wordpress".
- 将 koveshenin 和 www-data 用户添加到 wordpress 组.
- 将所有文件的组所有者更改为 wordpress(使用 chgrp).
- 确保所有文件都是组可写的.
- 在所有感兴趣的目录上设置 g+s (setgid) 权限位.
- 确保 kovshenin 和 apache 的默认 umask 包括 group read &写权限.
最后一步是诀窍.这意味着每当 kovshenin 或 apache 在这些目录中创建文件时,组所有者将被设置为 wordpress(而不是 kovshenin 或 apache).
I moved from a shared hosting to a VPS a few weeks ago and I'm having these annoying permission issues with WordPress. You know you can download and upgrade plugins (and wordpress itself) from the admin panel, but since I moved it started asking me my FTP credentials, which is kinda slow when I have to update ~20 plugins.
I think this should be some kind of rights issue. I looked that the shared hosting wordpress files, they all belong to the username and group kovshenin (kovshenin:kovshenin) and the files are -rw-r--r-- and the directories are drwx-r-xr-x.
On my VPS apache runs under apache:apache and my files are kovshenin:kovshenin. What should I do to make them readable and writable by both kovshenin and apache?
Also, I changed the permissions to 0777 for all files and folders of my wordpress installation, that allowed me to install and delete plugins without FTP, but when I pushed to automatic upgrade to WordPress 2.8.1 it still asked me for my FTP account. Is that a wp issue or did I miss something?
Thanks.
Update: I managed to run id
and id www-data
on the MediaTemple shared hosting. User kovshenin is in group kovshenin, and www-data is in group www-data. No more groups. What's the trick?
Another update Okay, I added the apache
user to the kovshenin
group, my wordpress files are kovshenin:kovshenin
with rw-rw-r--
permissions and drwxrwxr-x
permissions on directories, but something is still wrong. The user apache
can access the files and folders, I can use the online Themes and Plugins editor in the wordpress admin panel, I'm able to make changes to the .htaccess file from within wordpress, but plugin/theme installation still asks me for FTP credentials!
Any ideas? Thanks.
What should I do to make them readable and writable by both kovshenin and apache?
- Create a new group, say "wordpress".
- Add both koveshenin and www-data users to the wordpress group.
- Change the group owner of all the files to wordpress (using chgrp).
- Make sure all the files are group writeable.
- Set the g+s (setgid) permission bit on all the directories of interest.
- Make sure kovshenin and apache's default umask includes group read & write permission.
The second last step is the trick. It means that whenever kovshenin or apache creates a file in those directories, the group owner will be set to wordpress (instead of kovshenin or apache).
这篇关于一个一般的 linux 文件权限问题:Apache 和 WordPress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!