Last Updated: February 25, 2016
· heldrida

Wordpress: Easy way to enable SSH for updates!


If you ever worked with Wordpress, you realize that updates requires you to provide with FTP or FTPS (Not SFTP, that relies on SSH) to update the CMS, Plugins, themes, etc. A big pain!

FTP is vulnerable to attacks, so many people like me, personally, don't have it enabled on their servers! If you feel that you need to install and enable a FTP server, just for Wordpress, think twice - you can use SSH instead and I'll show you how!

So, you keep getting the error

Error: There was an error connecting to the server

You double tested your SSH / SFTP connections and it's working fine! This happens because wordpress uses FTPS and not SFTP.

I'm assuming you're using Ubuntu 12.04 LTS, so this is all you have to do:

sudo apt-get install libssh2-php

sudo service apache2 restart

The first command will install a php binding to libssh2 and after you restart your server, your wordpress should now present you with the option SSH2!

Supports public and private keys, or you can just omit it and use your SSH user and password!

Job done!

5 Responses
Add your response


This is amazing. I was just thinking to myself the other night how awesome it'd be if this could be done with public/private keys.

I will be trying this out on a few of my personal sites tonight. :) Thanks a lot for the tip!!

I'll report back with results, since I'll be trying this with a Debian Wheezy box.

over 1 year ago ·

Not having much luck. Even following these directions:

over 1 year ago ·

@tlongren thanks for reading! I'm too afraid to say the same, but the public/private keys didn't worked for me either. That's the solo reason why I've mentioned that you can use just the user/pw.

I'm not a Wordpress fan boy myself, but from time to time I have to work with it and it's always been a pain, having to deal with updates, etc.

I'm not sure, but I think that this may have something to do with the permissions on the directories where the keys are, which obviously I didn't tested because it's a bad practice to make those writable by others and so on.

In case you find a solution, no problem about forking this post and adding something else, or just leave a comment, I may edit it! Thanks for the link also, that other one is more advanced :)

over 1 year ago ·

I'll update you when I've got something solid. :)

over 1 year ago ·

Just a quick note to say I got this working by specifying the SSH port in the host, like so:

over 1 year ago ·