Public and Private keys incorrect for wp-user

Posted July 26, 2015 7.3k views


I’m on CentOS 7 with a LAMP stack.

I’ve a Wordpress installation which I’m trying to enable it to perform updates and installations via SSH. I’ve followed this tutorial from Digital Ocean which I’ve performed every step and more than double checked.

The problem is that whatever I’ve tried, I keep getting the error Public and Private keys incorrect for wp-user when I try to update a plugin or install a theme.

A minor difference than the tutorial I’ve followed: the tutorial didn’t gave a password for the specific Wordpress user but I did. I read somewhere that it might fail because of that.

Also as you can see as well, the tutorial goes on Ubuntu. The packages I’ve installed instead are(tutorial package > my installed package):

  • php5-dev > php-devel(v5.4.16-36)
  • libssh2-1-dev > libssh2-devel
  • libssh2-php > … (did some mumbo jumbo here)

Using sudo pecl install -f ssh2 gives the following:

PHP Warning: Module 'ssh2' already loaded in Unknown on line 0
downloading ssh2-0.12.tgz ...
Starting to download ssh2-0.12.tgz (26,223 bytes)
.........done: 26,223 bytes
ERROR: not installed

Can you please help me debug?

P.S. I’ve also asked the question here which hasn’t been answered yet but a user commented some on it although it wasn’t really helpful. I’m just sharing it as a heads-up.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

I solved it! Finally after a lot of frustrating days.

In the tutorial page, deep down in the comments, someone suggested removing/commenting the following line:


I did this and immediately the error message disappeared and things started getting updated.

Glad you solved it, however did you really solve it? I always wonder when disabling things such as you have, what the real impact is. If you were being told that the key was incorrect then it’s highly likely that the key was actually incorrect no? I have noticed many times all across the internet that people often have issues when it comes to public/private key usage and often these problems stem from incorrect formatting… a great example of this can be DKIM keys and SSH keys… often at key creation, there is some extra text added which needs to be removed to eventually end up with the correct format. Just a random thought… don’t pay it too much attention.

  • You’re right.

    Gone back and checked with private key file which I knew it included some texts as you’ve mentioned. Erased those and retried the procedure which changed nothing. So I’m back on using my solution.

    But as you’re right anyways, I’ll further investigate this issue in my spare time.

    Thanks for the good practice suggestion.