Wordpress SSH : Public and Private keys incorrect for wp-user

I followed the instructions for setting up SSH to the letter, even using the same username as wp-user.

When I try to install a plugin, it comes up with “Public and Private keys incorrect for wp-user”

I generated the key pair several times. Same problem!

When it didn’t work after several regens, I decided to generate my own using puTTY and then uploaded it to the /home/wp-user directory as wp_rsa,

In the Wordpress Connection Information page, it shows the following:


FTP/SSH Username wp-user

FTP/SSH Password … (I did not give wp-user a password as instructed not to)

Authentication Keys

Public Key: /home/wp-user/

Private Key: /home/wp-user/wp_rsa

Connection Type SSH2


I’ve been at this from morning to now evening. Frustrating.

Anyone have any idea why this isn’t working? TIA.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thank you for this - it also solved my problem :)

This question was answered by @rick741284:


I’m posting this here so that if someone else has this frustrating problem this might solve it.

Here is what I found:

Try to give www-data permission in wordpress directory:

cd /yourwordpress_dir/ sudo chown -R www-data:www-data *

In my case, I had to cd /var/www/html and then sudo chown -R www-data:www-data *


View the original comment

As mentioned, setting the entire wordpress path to www-data:www-data is insecure. At the minimum, you can get this to work by just setting wp-admin/includes/file.php permissions to www-data:www-data