[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Public and Private keys incorrect for user

Posted on 2014-01-30
10
Medium Priority
?
1,776 Views
Last Modified: 2014-02-02
I have wordpress 3.8 on centos 6.3 installed in
/home/wp

Open in new window


The directory is the home directory for wp-user
I have tried all the way to configure the wordpress ssh to install pliugins but I am always getting:
Public and Private keys incorrect for wp-user

The directory of wp-user is:
drwxr-xr-x   5 wp-user wp-user 4096 Jan 30 11:10 .
drwx------   2 wp-user wp-user 4096 Jan 30 11:10 .ssh
-rw-------   1 wp-user wp-user 4498 Jan 30 11:10 .viminfo
drwxr-xr-x   5 wp-user wp-user 4096 Jan 30 11:10 wordpress
-rw-------   1 wp-user wp-user  445 Jan 30 10:56 .bash_history
-rw-r-----   1 wp-user wp-user 1743 Jan 30 10:51 id_rsa
-rw-r-----   1 wp-user wp-user  400 Jan 30 10:51 id_rsa.pub
drwxr-xr-x   2 wp-user wp-user 4096 Jan 30 10:49 .vim
drwxr-xr-x. 10 root    root    4096 Jan 30 10:31 ..
-rw-r--r--   1 wp-user wp-user   18 Jul 18  2013 .bash_logout
-rw-r--r--   1 wp-user wp-user  176 Jul 18  2013 .bash_profile
-rw-r--r--   1 wp-user wp-user  124 Jul 18  2013 .bashrc

Open in new window


The permissions of the authorized_keys:
-rw-r--r-- 1 wp-user wp-user  400 Jan 30 11:10 authorized_keys

Open in new window


The contents of the authorized_keys:
from="127.0.0.1" ssh-rsa xxxxxxx == wp-user@mydomain.com

Open in new window


The contents of the id_rsa.pub
ssh-rsa xxxxxxx == wp-user@mydomain.com

Open in new window



Config in wp-config.php
efine( 'FTP_BASE', '/home/wp/wordpress/' );
define( 'FTP_CONTENT_DIR', '/home/wp/wordpress/wp-content/' );
define( 'FTP_PLUGIN_DIR ', '/home/wp/wordpress/wp-content/plugins/' );
define( 'FTP_PUBKEY', '/home/wp/id_rsa.pub' );
define( 'FTP_PRIKEY', '/home/wp/id_rsa' );
define( 'FTP_USER', 'wp-user' );
define( 'FTP_PASS', 'passphrase' );
define( 'FTP_HOST', '127.0.0.1:22' );

Open in new window


How can I solve this issue?
0
Comment
Question by:Ashraf Hassanein
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39822745
1 authorized_keys needs to be 600, try
chmod 600 authorized_keys

Open in new window

2. Use mds5sum to compare the authorized_keys and id_rsa.pub. If this is your only pub key on authorized_key they should match.

If it still fails post a verbose ssh session by invoking the -vvv flag

ssh -vvv host

Open in new window

0
 

Author Comment

by:Ashraf Hassanein
ID: 39822837
I have changed the permissions of the authorized_keys and check the mds5sum for both the authorized_keys and id_rsa.pub and they are indentical, when I did ssh -vvv host for the command line it worked perfectly I believe that there is something the WP config then.
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39823159
when I did ssh -vvv host for the command line it worked perfectly

Open in new window

If you can login passwordless then the keys are fine. Are you getting the same error or different error?
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:Ashraf Hassanein
ID: 39823298
Yes the same error!
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39824594
Can you post the commands you trying to run and the exact error?
0
 

Author Comment

by:Ashraf Hassanein
ID: 39825365
From the linux level I do not have any error I can ssh to the local host with no password, but my problem is with the wordpress when it tries to use SSH it gives this only vague error:

 Public and Private keys incorrect for wp-user

Open in new window

0
 
LVL 21

Accepted Solution

by:
Mazdajai earned 2000 total points
ID: 39825876
Try moving the keys into .ssh and make the private key to 600.

define( 'FTP_PUBKEY', '/home/wp/.ssh/id_rsa.pub' );
define( 'FTP_PRIKEY', '/home/wp/.ssh/id_rsa' );

Open in new window


If all fail generate a fresh pair of keys and copy to authorized_keys.
0
 

Author Comment

by:Ashraf Hassanein
ID: 39825949
Thank you so much for your help, this indeed help, also I have changed the permissions for the .ssh to:
chmod 755 .ssh

Open in new window

drwxr-xr-x   2 wp-user wp-user     4096 Feb  1 07:53 .ssh

Open in new window


And the Contents of .ssh to:
chmod 644 .ssh/id_rsa

Open in new window

-rw-r----- 1 wp-user wp-user  400 Feb  1 07:53 id_rsa.pub
-rw------- 1 wp-user wp-user  417 Jan 31 21:30 authorized_keys
-rw-r--r-- 1 wp-user wp-user  391 Jan 31 21:30 known_hosts
-rw-r--r-- 1 wp-user wp-user 1675 Jan 31 21:22 id_rsa

Open in new window


And surprisingly it is working thanks for your help.
However the ssh from the linux command line is not working but that not a problem or you think it is a security hole?
0
 

Author Closing Comment

by:Ashraf Hassanein
ID: 39827040
Great and helpful solution
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39827801
.ssh needs to be .700.  If you continue having an issue with ssh and keys, I would suggest opening a new thread.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question