Help installing client's SSH Public Key

kapsig431

Registered
Mar 24, 2013
3
0
1
cPanel Access Level
Root Administrator
I've never done this before, but a client has provided the corresponding SSH public key to their private key and every time I try to import it, I receive an error. I'm following the very simple instructions in my WHM cPanel by going to CcPanel>Manage root's SSH Keys>Import Key. From there I paste in the following key (I've modified it for security by adding "*"):

---- BEGIN SSH2 PUBLIC KEY ----
Subject: ****FTP1
Comment: "2048-bit rsa, ****[email protected]****ftp1, Fri Mar ** 20** 14:50:03 -0\
400"
AAAAB3NzaC1yc2EAAAADAQABAAABAQC9WZpw9wBlI9X+m7lRDwa1FUztfhebK4menHMhB+
7Bv****************************************Wz79GW/3qUrj7m1QbRw6isoAHsg
joGOI0wY/sJyFeqstCkqoe8/EPyvFTeNaEBd4QKyoYwhWAtWCUic61fZ7ygIM0++qZMHse
Otd33Zbl**************************************************/ucSUWFYKAMT
kbyrvO5731LLK08kOzPjCxMjF2WJx4EXEMbx6WqbsyUEagV+tNp5PYSia4pmTfmnOeBB3W
bun0ZDxXwigigHrDJCd9Df
---- END SSH2 PUBLIC KEY ----

Everytime I paste the non-obfuscated key, I receive this error:

The key named was imported.The key named was imported.Invalid key.

Can anyone point me in the right direction? Shouldn't I simply be able to paste my client's Public Key into the text field and click "Import"?

Thanks so much.
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
86
78
cPanel Access Level
DataCenter Provider
You should only need this part:

AAAAB3NzaC1yc2EAAAADAQABAAABAQC9WZpw9wBlI9X+m7lRDwa1FUztfhebK4menHMhB+
7Bv****************************************Wz79GW/3qUrj7m1QbRw6isoAHsg
joGOI0wY/sJyFeqstCkqoe8/EPyvFTeNaEBd4QKyoYwhWAtWCUic61fZ7ygIM0++qZMHse
Otd33Zbl**************************************************/ucSUWFYKAMT
kbyrvO5731LLK08kOzPjCxMjF2WJx4EXEMbx6WqbsyUEagV+tNp5PYSia4pmTfmnOeBB3W
bun0ZDxXwigigHrDJCd9Df
 

kapsig431

Registered
Mar 24, 2013
3
0
1
cPanel Access Level
Root Administrator
quizknows, thank you so much for your reply. I tried this before and received the same error. To make sure, I just tried it again and received the error again.

Any other ideas? I'm starting to get behind on this deliverable due to what should be a very simple key installation.

Thanks again.
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
86
78
cPanel Access Level
DataCenter Provider
Make sure it was generated in the proper format for openssh, that one may not have been.

In your situation, I'd just make a new key pair and give the private key to your customer. You can use the manage root's ssh keys feature to generate a new key pair.
 

kapsig431

Registered
Mar 24, 2013
3
0
1
cPanel Access Level
Root Administrator
Make sure it was generated in the proper format for openssh, that one may not have been.

In your situation, I'd just make a new key pair and give the private key to your customer. You can use the manage root's ssh keys feature to generate a new key pair.
I couldn't agree more. We planned to do that if we couldn't get this to work. Good idea and thanks for responding, quizknows.

Best.
 

rezman

Well-Known Member
Feb 3, 2011
45
0
56
USA
cPanel Access Level
Root Administrator
I just ran into this. I have people generating keys using the PuTTYGen app. After generating the key you can copy the key from the upper box and paste it into the public key box within Cpanel and it works. (See attached screenshot)

However people will click the save public key button and save it to a file and send those to me. They are in the following format.
Code:
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20140211"
AAAAB3NzaC1yc2EAAAABJQAAAQEAg+mGBY10bAy0F+unn6MjfYgWs7MXeHQADjL6
2yHYBcHoZ95sRR4GC2S+m+8iaS3qT5XwWC4mcF1xtpIb2EzZH6CkONw+cykqJERR
o1ZAwgYdgrZEyh8bXW32+BvYS5YT6i/66Ln7Z6rVC4rhu30f3yCXp1Fc8+GyDvA0
5d1mWu8krADlQg8RUqNjVF2Gd1G9Kqq+gcx0EV6x+NUC/XJBt1PY6XhJrT1P6RaB
hSmxSVvplNcy5JiemtvsEkVmrSzdmoz0ZWAYvkpilud/3FfAM0dKSTjnptkqxQdm
/GgDPhH8TafDQ2qFTmGBVUNsjh1mNI/hKHzt7AbsPOS+BVlbuw==
---- END SSH2 PUBLIC KEY ----
You CAN use this however you need to do the following:
1. Chop off the first and last lines.
2. Take the part of the comment between the double quotes and put it after the double equals at the end. Make sure there is a space AFTER the last '='. Do not quote the comment.
3. remove all newlines after each line.
4. Add "ssh-rsa " to the beginning.

Your outcome will look like this
Code:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAg+mGBY10bAy0F+unn6MjfYgWs7MXeHQADjL62yHYBcHoZ95sRR4GC2S+m+8iaS3qT5XwWC4mcF1xtpIb2EzZH6CkONw+cykqJERRo1ZAwgYdgrZEyh8bXW32+BvYS5YT6i/66Ln7Z6rVC4rhu30f3yCXp1Fc8+GyDvA05d1mWu8krADlQg8RUqNjVF2Gd1G9Kqq+gcx0EV6x+NUC/XJBt1PY6XhJrT1P6RaBhSmxSVvplNcy5JiemtvsEkVmrSzdmoz0ZWAYvkpilud/3FfAM0dKSTjnptkqxQdm/GgDPhH8TafDQ2qFTmGBVUNsjh1mNI/hKHzt7AbsPOS+BVlbuw== rsa-key-20140211
That is exactly the same as what you would copy and paste from the PuTTYGen screen. Pasting this into the public key within Cpanel will work.
 

Attachments