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!