Can’t Authorize SSH Key in cPanel

I was working on a new website that is on a shared host using cPanel. I contacted the host and had them activate SSH access on the account for me, and then I added my public key using cPanel’s import feature. After adding my key, I clicked on “Manage” to authorize the key for use, but I just got a blank cPanel screen with no options on it other than the “Go back” link.

I thought maybe something was stuck so the page wasn’t loading, so I tried logging out of cPanel and back in as well as closing and reopening my browser and then rebooting my computer. I still wasn’t getting any options to authorize my key. I tried a different browser, same result.

Then, I tried to delete and readd my key, thinking that maybe something went awry when adding the key. However, when I clicked Delete on the key entry, I got an error saying, “Could not delete <key path and name>”

Next, I tried to just ignore the broken key and add my public key again, but it would not allow me to add the key twice (so at least I knew it was recognizing the key was there).

After talking with one of the awesome tech support people at my hosting company (Eboundhost), I found out that cPanel cannot handle special characters in the key name. I had named my key “Beth’s key”, and since cPanel did not give me any errors when selecting that name, I did not think that would be an issue. cPanel could not handle the apostrophe, though, and that was preventing me from authorizing, or even deleting, the key.

To solve the issue, I deleted the key manually. This is not something I would recommend doing unless you are very comfortable with your server and how it stores keys. In my case, since I could not use my key to SSH into the server, I thought about generating a new key pair to use, but to save time, I instead just used cPanel’s terminal to SSH in and delete the key manually. You could also contact your hosting company’s tech support and ask them to manually delete the key for you (as some companies may not give you access to the directory where the keys are stored). cPanel gives you the key path and file name in the error message you receive when you attempt to delete the key.

After the key was deleted, I was able to add my public key with a name containing no special characters. I clicked “Manage” and was able to authorize the key with no issues.

Leave a Reply

Your email address will not be published. Required fields are marked *