r90mpw
Last Updated: February 25, 2016
·
2.753K
· heldrida
6ba51be61ac6a969f616d9e2f073d039

Wordpress: Easy way to enable SSH for updates!

Hi,

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!

Say Thanks
Respond

5 Responses
Add your response

10456
6cc6e8508375f754cd953bcb6917894e

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 ·
10495
6cc6e8508375f754cd953bcb6917894e

Not having much luck. Even following these directions:
http://robpickering.com/2012/05/configure-ssh2-access-for-updating-wordpress-645

over 1 year ago ·
10497
6ba51be61ac6a969f616d9e2f073d039

@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 ·
10588
6cc6e8508375f754cd953bcb6917894e

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

over 1 year ago ·
14736
E2f94572a7ac14970d9bd38947c00ad5

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

Hostname: 127.0.0.1:22
Username: MYSSHUSER
Password: MYSSHPASSWORD
over 1 year ago ·
Filed Under