0

Having a pretty tough time getting WordPress to recognize my SSH keys. I know that the keys themselves work, because I use them to SSH into the server myself. Despite going over this tutorial repeatedly, as well as some other ServerFault answers that I'll reference below, I can't seem to figure it out.

I'm using Ubuntu 16.04 and Apache. I have a non-root user with sudo permissions, named 'jake'.

The permissions over /home/jake/.ssh are as follows:

drwx------ 2 jake jake 4096 Aug 12 23:42 ./
drwxr-xr-x 5 jake jake 4096 Aug 10 13:20 ../
-rw-r--r-- 1 jake jake  743 Aug 12 16:21 authorized_keys
-rw------- 1 jake jake 3247 Aug 10 13:58 id_rsa
-rw------- 1 jake jake  743 Aug 10 13:58 id_rsa.pub
-rw-r--r-- 1 jake jake  222 Aug 12 23:42 known_hosts

Which I believe matches the guide, which says to use chmod 700 on the .ssh directory, and 0644 on authorized_keys. I skipped the step of restricting the key to only be used by 127.0.0.1, because I am using that key to SSH into the server.

At the end of /var/www/html/wp-config.php, I have the lines specified by the tutorial:

define('FS_METHOD', 'ssh2');
define('FTP_PUBKEY','/home/jake/.ssh/id_rsa.pub');
define('FTP_PRIKEY','/home/jake/.ssh/id_rsa');
define('FTP_USER','jake');
define('FTP_PASS','');
define('FTP_HOST','127.0.0.1:22');

The tutorial does have some advice at the bottom, with things such as checking the permissions - but I did, and I don't personally see anything wrong, although I'm certainly no Linux expert. In addition, I tried researching other answers - this user is on CentOS with Nginx, so I'm not sure how relevant it is, but the accepted answer is to have the web server own the id_rsa and id_rsa.pub files - when I tried doing chown www-data:www-data id_rsa (and id_rsa.pub), it didn't make a difference. This other question doesn't have an accepted answer, but the only answer with an upvote says to run chmod g-r wp_rsa, but that also didn't make a difference.

Jake
  • 113
  • 5

1 Answers1

0

The default ssh module does not seem to work. It will fail if your key is password protected. From the forums, this module has had ongoing issues. Some seem to tie to issues with libssh2 suport in PHP5. It seems to be broken again in PHP 7.

SSH SFTP Updater Support does work for me. I have installed Version 0.7.1 | By TerraFrost

BillThor
  • 27,737
  • 3
  • 37
  • 69
  • Interesting, haven't seen that anywhere. The WordPress forum search leaves a lot to be desired. Looking at that plugin, it appears to have been last updated a year ago - I tend to avoid those plugins, but it doesn't seem to have any known vulnerabilities. I'll give it a try. Thanks! – Jake Aug 13 '16 at 01:52