Using Public Keys With Putty to Connect to WHM running on Linux

Update: Instructions take now the user name into account, not defaulting to root.

So the other day I wanted to set up SSH with public keys through putty so I could connect to WHM. While I did find the instructions on how to do it, the instructions were lacking a lot of information. After a lot of google I was able to figure it out. So I figure I would share the steps I took. Here is a step by step guide that should make someone’s life a little easier:

Part A – Setting up your Public Keys

1- Log in into your WHM and go to “SSH Password Authorization Tweak” under “Security Center”

2- Disable Password Auth – this is so we can only access ssh with a key

3 – Go to “Manage root’s SSH Keys” under “Security Center”

4 – Click on “Generate a New Key”

5 – On the key name, use the username you wish to login as. For example ‘root’ then create a password

6 – Click Generate Key

7 – Go back to “Manage root’s SSH Keys” and click on “Manage Authorization” on the public key

8 – Enable authorization and go back to “Manage root’s SSH Keys”

9 – click on “View/Download” on the private key

10 – type the password you used when creating the key into the passphrase box and click “Convert”

11 – copy the text generated and save it to your desktop in a file with extension .ppk (you can name this whatever you want)

Part B – Connecting with Putty

For putty to use the private key correctly you need to open the private key with “pageant” this is provided for free with putty if you use the everything installer or downloaded individually from putty’s download page. I recommend you download the “Windows Installer for Everything” from:

Download Page for Putty

1 – Open the .ppk file with Pageant if you used the installer and did not change the default  file association settings then you should be able to just double click the file.

2 – You will be asked for the password – enter the password used in the creation of the key

3 – Open Putty and enter the address of your web server – Make sure you click on SSH

4 – When you click connect type the user we set up when creating the key in this case it was root

If everything was setup right you should have SSH access to your web server now

 

30 Comments



    1. Thanks for the post back. Your explanations is very thorough good job

      Reply

      1. Thank you mate you clear and updated me on the SSH ACCESS using the new security implemented on WHM and was puzzled since Im testing a VPS hosted server with godaddy and there documentation lacks so much!! I had an idea and was getting close to the answer but you close the lid; EVERYBODY COPY AND PASTE THIS AND GIVES PROPS to a MASTER. A master not because of the information; a master because of how organized and simple the steps were written including additional tools for putty. I got the answer but I’ll stick to the standard access for now or disable SSH access to the site…. JAJAJA Thanks.

        Reply

  1. Hey! Thank you so much for this. I was unable to connect to Putty, but this tutorial was excellent. Thanks for real!

    Reply

    1. No problem. maybe you missed a step? every time I need to set up ssh access, I come back to this article. I can never remember the steps but this works every time. I would love to help you if you give me some more details.

      Reply

  2. I’m totally lost, I still don’t get it and am finding it so frustrating

    Reply

  3. item 11 – copy the text generated … save into a file …

    What, do you save ALL the text in the box into one file ? The public key and the private key and the notational text at the top of the box too ?

    Reply

    1. Yes, whatever was generated in the text box

      Reply

  4. I have struggled with this for ages – worked first time. Thank you so much!

    Reply

  5. For some reason, my (PuTTY PPK format): Box comes empty.
    I have tried this multiple times. yet the box comes empty.
    I followed your steps to the end.

    Reply

  6. I found a workaround for that problem using putty key generator though.
    Thank you.

    Reply

  7. Dear Carlos Roque,

    What a great tutorial , that you was wrote..! I was very tired before 3 month to login ssh with putty. Now my concept is clear. Lot of thanks Boss.

    Reply

  8. Finally! Instructions that actually made sense!

    Thank you so, so very much!!!

    Reply

  9. Super useful little tutorial thanks. I had been doing it another way but this seems to make things a lot quicker when logging in (no password required each time).
    Cheers

    Reply

  10. I get no supported authentication methods available. Very frustrating.

    Reply

    1. You probably have other keys loaded. There is a limit of how many authentication methods can be tried. I think it is 3. So your key never gets tried.

      Reply

      1. Where are the other keys loaded? in pageant? in WHM?

        Reply

        1. Did you make sure to load your key in pageant? It could also be that the key wasn’t loaded.

          Reply

          1. Yes. I loaded it into pageant and added the password for it which it accepted. There only appeared to be one in there. Do you mean more than 3 keys loaded into WHM?


    2. The article assumes your username is root. That is the most common username. If you authenticate with something different then change root to your username name on the instructions

      Reply

      1. Ah now I understand. I think your article should state that because upon reading your last comment I would not have chosen a different name for the key and would not have blocked my self with my own firewall :/

        And what about the 3 keys? Are they in WHM? There are 4 keys in there as of now

        Reply

        1. Still my other keys are not called root so what the deal there??? the default I believe is id_dsa…?

          Reply

          1. Yeah the file name doesn’t matter. The user name is encoded in the key. As the other 3 key I am not sure where you got them. Restarting pageant should clear them out


          2. Updated the article to state using a different user name


        2. Yeah I wrote this a long time ago I will try to update it some time

          Reply

          1. It ranks high in Google. The only reason I followed the steps was because of the positive comment 3 months ago.


  11. Strange. And now I am getting timeouts on my SSH, Website, cPanel and WHM. even though it is still up. Hmmm have I been blocked?

    Reply

    1. That makes sense. See my previous response

      Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.