要执行请求的操作,wordpress需要访问您的Web服务器。请输入您的ftp
-
-
这是本地主机安装吗?如果是这样,请参阅:http://wordpress.stackexchange.com/questions/19649/wordpress-on-localhost-lamp-doesnt-let-me-install-pluginsIs this a localhost installation? If so, see: http://wordpress.stackexchange.com/questions/19649/wordpress-on-localhost-lamp-doesnt-let-me-install-plugins
- 1
- 2016-06-02
- Greg McMullen
-
@GregMcMullen不,这是* NOT * localhost安装,您评论的链接的"已接受"答案是将wordpress目录的所有权递归更改为`nobody`-这对我不起作用,因为`httpd`运行为`阿帕奇@GregMcMullen no, this is *NOT* localhost installation & "accepted" answer from link that you comment is to recursively change ownership of a wordpress directory to `nobody` - this won't work for me due to `httpd` runs as `apache`.
- 1
- 2016-06-02
- alexus
-
@alexus看来您的文件目前归root.apache所有.您是否尝试过apache.apache而不是没人?@alexus It looks like your files are owned by root.apache at the moment. Did you try apache.apache instead of nobody?
- 0
- 2016-06-02
- Tim Malone
-
@TimMalone将文件/目录设置为`apache.apache`或`root.apache`没什么区别,只要`httpd`运行为`apache`,并且`apache`的`uid`是`apache`gid`的组,都是一样的,因为我的权限设置为`g + w`.@TimMalone setting files/directory as `apache.apache` or `root.apache` wouldn't make any difference, as long as `httpd` runs as `apache`, and `apache`'s `uid` is part of `apache` `gid`'s group, it's all the same, because my permissions set to `g+w`.
- 0
- 2016-06-02
- alexus
-
@alexus好的,还可以尝试-在wp-config.php(https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants)中将FS_METHOD设置为" direct"@alexus Ok, something else to try - set FS_METHOD to 'direct' in wp-config.php (https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants)
- 0
- 2016-06-02
- Tim Malone
-
@TimMalone,网址为https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants-"请注意,此处的选择会严重影响安全性."@TimMalone per https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants - `Note that your selection here has serious security implications.`
- 0
- 2016-06-02
- alexus
-
@alexus参见http://wordpress.stackexchange.com/questions/189554/what-security-concerns-should-i-have-when-setting-fs-method-to-direct-in-wp-co@alexus See http://wordpress.stackexchange.com/questions/189554/what-security-concerns-should-i-have-when-setting-fs-method-to-direct-in-wp-co
- 0
- 2016-06-02
- Tim Malone
-
6 个回答
- 投票数
-
- 2017-06-22
将以下内容添加到wp-config.php:
define( 'FS_METHOD', 'direct' );
让我知道它如何为您工作.
Add the following to wp-config.php:
define( 'FS_METHOD', 'direct' );
Let me know how it works for you.
-
https://wordpress.stackexchange.com/questions/189554/what-security-concerns-should-i-have-when-setting-fs-method-to-direct-in-wp-cohttps://wordpress.stackexchange.com/questions/189554/what-security-concerns-should-i-have-when-setting-fs-method-to-direct-in-wp-co
- 2
- 2017-06-22
- alexus
-
为我工作,除非您在文件系统中具有错误的权限.顺便说一句,我在wp-config.php的最顶部添加了它worked for me unless you have bad permissions in the file system. Btw I added it at the very top of the wp-config.php
- 0
- 2018-09-28
- Toskan
-
使用此方法之前,请务必阅读Alexus链接到的帖子.此方法肯定有效(它为我解决了问题),但绝对不应该在共享主机环境或任何有风险的环境中使用此方法,因为这样做可能会损害安全性.Make sure to read the post Alexus linked to before using this method. This method definitely works (it solved the problem for me), but you should definitely not use this method in a shared hosting environment or any at-risk environment where you could compromise security by doing this.
- 0
- 2019-05-18
- JamesHoux
-
添加此后,我得到此错误: `更新失败:无法安装更新,因为我们将无法复制某些文件.这通常是由于文件权限不一致造成的.after adding this I have getting this error: `Update Failed: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.`
- 0
- 2020-03-18
- Sabbir
-
- 2016-08-05
这表示WordPress在安装文件夹中进行更改的权限有限.
为了解决此问题,您所需要做的就是为其提供必要的权限.
通过SSH连接到服务器后,在终端/腻子/命令行提示符中运行以下命令:
sudo chown -R apache:apache /var/www/html
结帐这篇文章以获取详细信息.
This means that WordPress is having limited permission for making changes in the folder that it was installed.
In-order to fix this, all that you need to do is provide necessary permissions for the same.
Run the following Command in your Terminal / Putty / Commandline Prompt after connecting to your Server via SSH:
sudo chown -R apache:apache /var/www/html
Checkout this article for full details.
-
权限很好,请重新阅读我的问题)permissions are fine, re-read my question)
- 0
- 2016-08-05
- alexus
-
chown:无效用户:‘apache:apache’chown: invalid user: ‘apache:apache’
- 3
- 2018-02-02
- numediaweb
-
记住,Apache可以是使用不同Linux版本的不同用户.因此,您可以尝试使用组
并查看是否出错,因为Apache的用户和组通常是相同的.然后使用正确的用户.在Ubuntu中,最常见的是用于生成Apache文件的" www-data:www-data"或" www:www". Remember, Apache can be different users in different flavors of Linux. So you can try groupsand see if it errors out or not, since the user and group for Apache is usually the same. Then use the correct user. The most common in Ubuntu is "www-data:www-data" or "www:www" for chown-ing Apache files. - 2
- 2019-01-25
- MontyThreeCard
-
在我找到正确的用户名之后,这非常有用(另请参阅[列出所有用户的命令](https://askubuntu.com/questions/410244/a-command-to-list-all-users-and-how-to-add-delete-modify-users/410274#410274))After I could find the right user name this worked just great (see also [command to list all users](https://askubuntu.com/questions/410244/a-command-to-list-all-users-and-how-to-add-delete-modify-users/410274#410274))
- 0
- 2020-01-08
- Top-Master
-
如果要在OSX上使用它,请使用_www:_www(莫哈韦沙漠,不知道其他版本的含义)In case you want to use it on OSX, use _www:_www (Mojave, don't know what it wolud be in other versions)
- 0
- 2020-05-06
- Larzan
-
- 2017-08-23
即使所有权为具有权限775的
root:apache
和httpd以apache
的身份运行是完全正确的,但Wordpress并不喜欢这样.根据apache
,它希望所有者是apache
:// Attempt to determine the file owner of the WordPress files, and that of newly created files $wp_file_owner = $temp_file_owner = false; if ( function_exists('fileowner') ) { $wp_file_owner = @fileowner( __FILE__ ); $temp_file_owner = @fileowner( $temp_file_name ); }
您将是:
wp_file_owner=根
temp_file_owner=阿帕奇if ( $wp_file_owner !== false && $wp_file_owner === $temp_file_owner ) { // WordPress is creating files as the same owner as the WordPress files, // this means it's safe to modify & create new files via PHP. $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'file_owner'; } elseif ( $allow_relaxed_file_ownership ) { // The $context directory is writable, and $allow_relaxed_file_ownership is set, this means we can modify files // safely in this directory. This mode doesn't create new files, only alter existing ones. $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'relaxed_ownership'; }
如果$ wp_file_owner与$temp_file_owner相同,则继续.您的将陷入elseif中,根据注释,该elseif不允许删除/创建,而只能进行更新(我通过在Wordpress中更新插件的代码来验证了这一点,并且有效).
请注意,我没有广泛浏览代码,这只是我的快速解释.我遇到了同样的问题,当我切换user:group以便httpd用户也是文件所有者时,它不再提示输入FTP凭据.
Even though it is totally correct to have the ownership as
root:apache
with permissions 775, and httpd to run asapache
, Wordpress does not like this. It wants the owner to beapache
, as perwp-admin/includes/file.php
:// Attempt to determine the file owner of the WordPress files, and that of newly created files $wp_file_owner = $temp_file_owner = false; if ( function_exists('fileowner') ) { $wp_file_owner = @fileowner( __FILE__ ); $temp_file_owner = @fileowner( $temp_file_name ); }
Yours would be:
wp_file_owner = root
temp_file_owner = apacheif ( $wp_file_owner !== false && $wp_file_owner === $temp_file_owner ) { // WordPress is creating files as the same owner as the WordPress files, // this means it's safe to modify & create new files via PHP. $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'file_owner'; } elseif ( $allow_relaxed_file_ownership ) { // The $context directory is writable, and $allow_relaxed_file_ownership is set, this means we can modify files // safely in this directory. This mode doesn't create new files, only alter existing ones. $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'relaxed_ownership'; }
If $wp_file_owner is same as $temp_file_owner then proceed. Yours would be caught in the elseif, which according to the comment does not allow delete/create, but only updates (I verified this by updating the code of a plugin from within Wordpress, and it worked).
Note I did not extensively look through the code, this is just my quick interpretation. I had the same problem and once I switched user:group so that the httpd user is also the file owner, it did not prompt for FTP credentials anymore.
-
- 2016-06-03
这不是直接的答案,但是可能不得不说-这是您应该避免解决的一个问题,除非您正在谈论本地开发,在这种情况下,您可以将权限设置为777.
原因是,如果Web服务器可以覆盖您的代码,则在它上面运行的任何恶意代码也将能够做到这一点.风险要比不必键入ftp凭据节省几秒钟的便利大得多.
Not a direct answer, but probably has to be said - this is one problem you should avoid solving unless you are talking about a local development in which case you can just set permissions to 777.
The reason is that if the webserver can overwrite your code, then any malicious code running on it will be able to do that as well. The risk is just so much bigger than the convenience of saving few seconds by not having to type the ftp credentials.
-
- 2018-05-01
尽管问题不再是新问题了,我还是想在这个问题上再加上两美分.
很多ppl的VPS服务器上都有Centos(7),下面的代码行可以解决他们的问题.
Imho与SELinux息息相关,SELinux阻止WordPress按要求工作.到目前为止,将解释 SELinux 是什么以及它的作用.仅供参考,介绍始于:
安全性增强Linux(SELinux)是在内核中实现的强制性访问控制(MAC)安全性机制.
只需执行以下3个步骤:
- 1打开一个终端(或通过SSH访问服务器)
- 2添加以下代码行
chcon -R -t httpd_sys_content_t/var/www/html/wordpress
- 3添加第二行代码
chcon -R -t httpd_sys_rw_content_t/var/www/html/wordpress
无需从服务器重新启动,也无需从任何守护程序重新启动.
我不会说它对所有人都有帮助,但是对于那些没有禁用SELinux的人来说,这应该是一种缓解.
欢呼
注意:请根据自己的需要进行调整(即WordPress的路径)
edit:在
wp-config.php
define(" FS_METHOD"," direct"); >,因为当上述代码行按需进行时,这绝对是不可行的.Although the question is not that new anymore I want to add my two cents on this issue also.
A lot of ppl have Centos(7) on their VPS server and following code lines could solve their problem.
Imho has all to do with SELinux which withholds WordPress from doing it's job as wished. It goes to far to explain what SELinux is and what it does. FYI the introduction starts with:
Security-Enhanced Linux (SELinux) is a mandatory access control (MAC) security mechanism implemented in the kernel.
Only 3 steps to folow:
- 1 Open a terminal (or access the server through SSH)
- 2 Add following code line
chcon -R -t httpd_sys_content_t /var/www/html/wordpress
- 3 Add second code line
chcon -R -t httpd_sys_rw_content_t /var/www/html/wordpress
No reboot from the server or restart from any daemon needed.
I won't say it helps everybody but for those who didn't disable SELinux it should be a relieve.
Cheers
Note: Please adjust to your own needs (meaning path to WordPress)
edit: be sure to remove the line
define("FS_METHOD", "direct");
when it is/was used inwp-config.php
because that's absolutely a no go when above code lines do as wanted. -
- 2018-08-16
对于我来说,我是通过从GIT切换回FTP模式解决的.
不再警告.
也许对其他人也有帮助.
In my case, I solved this by switching from GIT back to FTP mode.
No more warning.
Perhaps that'll help somebody else too.
我正在关注更改文件权限«WordPress Codex ,但是当我尝试通过
plugin
更新和/或安装theme
和/或wp-admin
,我得到以下提示:从文件系统级别:
httpd
以apache
运行:我希望能够通过
install
执行请求的操作(update
和/或/wp-admin
)没有 FTP凭据.我该怎么做?