I am using WordPress on my live server which only uses SFTP using an SSH key.
I want to install and upgrade plugins, but it appears that you are required to enter your FTP login to install the plugins. Is there a way to install and upgrade plugins by manually uploading the files instead of having WordPress handle the entire process?
It is possible to use SFTP or SSH to auto update Plugins in WordPress, but you need to have ssh2 pecl extension. You can find out how to do it, using the following tutorial
Execute the following code in terminal
For further detail visit Wordpress on Ubuntu install plugins without FTP access
Just wanted to add that you must NEVER set the
wp-content
permission or permission of any folder to777
.This is what I had to do to:
1) I set the ownership of the wordpress folder (recursively) to the apache user, like so:
# chown -R apache wordpress/
In case of Ubuntu, Mint or Debian
# chown -R www-data:www-data wordpress/
2) I changed the group ownership of the wordpress folder (recursively) to the apache group, like so:
# chgrp -R apache wordpress/
Skip this step for Ubuntu, Mint or Debian
3) give owner full privilege to the directory, like so:
# chmod u+wrx wordpress/*
And that did the job. My
wp-content
folder has755
permissions, btw.TL;DR version:
In order to enable the use of SSH2 for your updates and theme uploads, you have to generate your SSH keys and have the PHP SSH module installed. Then WordPress will detect that you have SSH2 available and you'll see a different option (SSH2) displayed when doing an upload/upgrade.
1.) Make sure you have the PHP module installed for debian it is:
2.) Generate SSH keys, adding a passphrase is optional:
3.) Change the permission so that WordPress can access those keys:
Now you'll get the SSH2 option when doing an upload/upgrade/plugin.
4.) For added ease you can setup the defaults in your
wp-config.php
and this will pre-populate the SSH credentials in the WordPress upload window.The 'passphrase' is optional, if you don't setup a passphrase during
ssh-kengen
; then don't add it inwp-config.php
This solved my issue. And I didn't have to do the
chown
at all. But I have seen this method referenced in other places.References:
Add the following code to wp-config
FS_METHOD forces the filesystem method. It should only be direct, ssh2, ftpext, or ftpsockets. Generally, you should only change this if you are experiencing update problems. If you change it and it doesn't help, change it back/remove it. Under most circumstances, setting it to 'ftpsockets' will work if the automatically chosen method does not.
(Primary Preference) "direct" forces it to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts, This is chosen automatically when appropriate.
(Secondary Preference) "ssh2" is to force the usage of the SSH PHP Extension if installed
(3rd Preference) "ftpext" is to force the usage of the FTP PHP Extension for FTP Access, and finally
(4th Preference) "ftpsockets" utilises the PHP Sockets Class for FTP Access
For more information visit: http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants
1.change from php_mod to fastcgi with cgi & SuEXEC enabled ,works for me
don't forget if don't work try to change
2. change wp-content to 775 as root
chmod -R 775 ./wp-content
3- add to wp-config.php
define('FS_METHOD', 'direct');
i hope it works