Saved SSH key does not work in cPanel SSH Key page

View QuestionsCategory: QuestionsSaved SSH key does not work in cPanel SSH Key page
admin Staff asked 5 years ago

Generated key in putty keygen
Try to paste public key and it says “key invalid”
cPanel -> SSH Access -> Import SSH Key

Error:
Failed to import public key named “”.
Invalid key.

1 Answers
admin Staff answered 5 years ago
  1. Open pub key file
  2. You CAN use this however you need to do the following:
  3. Chop off the first and last lines.
  4. 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.
  5. remove all newlines after each line.
  6. Add “ssh-rsa ” to the beginning.
---- 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 ----

Your outcome will look like this

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAg+mGBY10bAy0F+unn6MjfYgWs7MXeHQADjL62yHYBcHoZ95sRR4GC2S+m+8iaS3qT5XwWC4mcF1xtpIb2EzZH6CkONw+cykqJERRo1ZAwgYdgrZEyh8bXW32+BvYS5YT6i/66Ln7Z6rVC4rhu30f3yCXp1Fc8+GyDvA05d1mWu8krADlQg8RUqNjVF2Gd1G9Kqq+gcx0EV6x+NUC/XJBt1PY6XhJrT1P6RaBhSmxSVvplNcy5JiemtvsEkVmrSzdmoz0ZWAYvkpilud/3FfAM0dKSTjnptkqxQdm/GgDPhH8TafDQ2qFTmGBVUNsjh1mNI/hKHzt7AbsPOS+BVlbuw== rsa-key-20140211

Credit/source: https://forums.cpanel.net/threads/help-installing-clients-ssh-public-key.332951/