In order to enable the use of SSH2 for your updates and theme uploads, you have to generate your SSH keys and have the PHP SSH module installed. Then WordPress will detect that you have SSH2 available and you'll see a different option (SSH2) displayed when doing an upload/upgrade.
1.) Make sure you have the PHP module installed for debian it is:
sudo apt-get install libssh2-php
2.) Generate SSH keys, adding a passphrase is optional:
ssh-keygen
cd ~/.ssh
cp id_rsa.pub authorized_keys
3.) Change the permission so that WordPress can access those keys:
cd ~
chmod 755 .ssh
chmod 644 .ssh/*
Now you'll get the SSH2 option when doing an upload/upgrade/plugin.
Here is a pic, I don't have enough rep. to post an image. Here is a link to the image that you'll get, hopefully this is okay to include.
https://www.dropbox.com/s/1m7fxlkp0nchplx/ssh-connection.png
4.) For added ease you can setup the defaults in your wp-config.php
and this will pre-populate the SSH credentials in the WordPress upload window.
define('FTP_PUBKEY','/home/<user>/.ssh/id_rsa.pub');
define('FTP_PRIKEY','/home/<user>/.ssh/id_rsa');
define('FTP_USER','<user>');
define('FTP_PASS','passphrase');
define('FTP_HOST','domain.com');
The 'passphrase' is optional, if you don't setup a passphrase during ssh-kengen
; then don't add it in wp-config.php
This solved my issue. And I didn't have to do the chown
at all. But I have seen this method referenced in other places.
References: