How to update wordpress plugin and theme while using SFTP SSH connection

September 9, 2016 11.7k views
WordPress Ubuntu Ubuntu 16.04

I installed Ubuntu 14.4.5 x64 in a droplet i created and installed vestaCP to host mulitple wordpress sites. I am using SFTP and no FTP is used for security purpose. Problem came when i tried to update my plugins. I was asked for Hostname, FTP Username, FTP Password. i can give my IP as host name for username root but for password I need to upload the SSH file but there is no option for that. If there is any solution please give me the details.

  • I have already read the tutorials... but I am using Nginx and my Apachi is desabled

  • You need to make files in your public folder writable by nginx user. Simply find the nginx user (default www-data) and change the folder ownership to that user. Your errors will go away.

  • Whenever i try to save the SSH key after giving the comment
    ssh-keygen -t rsa -b 4096
    it says "Saving the key failed'. i specified all my paths but its not helping.
    I am using nginx and already installed vestaCP in my ubuntu 14.4.5 x64.

    Here i shall specify my code samples that I used here.


    I am using this because i did not directly installed wordpress in the server but rather used vestacp to host multiple sites.

2 Answers

You need to change wp-config to use SSH, and specify user, SSH keys.

Also you should install php-dev, libssh2, libssh2-php to make it work.

Refer to How To Configure Secure Updates and Installations in WordPress on Ubuntu. It's an older tutorial, but will help you

by Justin Ellingwood
WordPress is the most popular content management system (CMS) on the web currently. While WordPress can be a great way to manage you content, there are some very insecure configurations that are given throughout the internet. This article will cover how to set up secure updates and installations using SSH keys instead of FTP, which is an inherently insecure protocol.

I have already read the tutorials... but I am using Nginx and my Apachi is desabled

  • The tutorial should be same for both Apache and Nginx.
    All 3 packages are php based packages, so it is same for both Apache and Nginx and doesn't make any difference.

    Only different step is that you don't execute sudo service apache2 restart.
    In this situation you execute sudo service nginx restart

    • sudo apt-get install php5-dev libssh2-1-dev libssh2-php

      Doesn't work.

      • Which one is error ?
        If you don't see which one errors, try installing one by one, e.g.:
        sudo apt-get install php5-dev
        sudo apt-get install libssh2-1-dev
        sudo apt-get install libssh2-php

Have another answer? Share your knowledge.