How to use sftp instead of ftp when updating wordpress plugins?

Website Information:

Protocol : SFTP

Server : Google Cloud

Wordpress Version : 4.9.8

I am trying to update my WordPress plugins but every time I try to do it, it always asks me for my FTP information but when I supplied my FTP information it returns an error 'Failed to connect to FTP Server.'

I even tried to add Port number '21' and '22' on the hostname but it still doesn't work. I even tried using 'FTPS (SSL)' Connection type but it didn't work either. I've also used the plugin 'SSH SFTP Updater Support' but it leaves my website under maintenance and I can't access it anymore.

I've spent 2 days resolving this problem. Hope that someone can help me with this.

Thank you in advance :)

1 answer

  • answered 2018-11-08 16:05 Kamran Syed

    FTP and SFTP are two different protocols. Wordpress offers a facility to upload plugin via FTP. However Wordpress does not have SFTP support to install plugins as of now, AFAIK. You can go with any of the following routes.

    • Enable Direct Method Wordpress will be able to install plugins automatically and FTP or SFTP will not be needed. You need to edit wp-config and add following line:

      `define('FS_METHOD', 'direct');`  
      

      You can read more on this post

    • Upload plugin zip file via SFTP You can download plugin and then upload downloaded zip file via your SFTP client e.g filezilla or you can do it from terminal (non-Windows OS) using scp. Reference for installing plugin manually can be found here and instructions on using scp on Linux can be found here