How to Generate and Use SSH key on a cPanel Server

cpanel

For security reason, it is highly recommended that you use SSH key to login to your server via SSH instead of using root password. In this tutorial I will explain how to use SSH key to login to your server via SSH as root user.

Step 1:

Disable SSH Password Authorization Tweak. For security reason, you should disable SSH Password Authorization Tweak from:

WHM Home >> Security Center >> SSH Password Authorization Tweak

disable-password-auth

Step 2:

Now we will generate SSH key on a cPanel server. In WHM, navigate to:

WHM Home >> Security Center >> Manage root’s SSH Keys

And click Generate a New Key.
manage-root-key

Step 3:

Fill the form for the new SSH key and click Generate Key button. Key name can be anything like your server name or your name. Use a strong key password. Please note, you should not use your root password.
manage-root-key

Step 4:

In this step we will authorize the key. Click Manage Authorization for the key that we have generated.
authorize-ssh-key
And Authorize this new key.

Step 5:

In this step we will download the SSH key. Click View/Download Key under Private Keys section.
view-download-ssh-key

Enter the password that you have used in step 3 while generating this key and click convert button.
convert-ssh-key

Step 6:

Copy the key and paste it on a notepad file. Save this text file as ssh.ppk on your computer. Please note, you may use different name for this ssh key file, but you must use .ppk extension.
putty-ppk-ssh-key

Step 7:

So, we have generated and downloaded the SSH key. To use this SSH key with putty, we need to download Pageant.
Download Pageant

Step 8:

After downloading pageant, run it and click Add Key button.
pageant

Browse and select the ssh.ppk file that we have saved in step 6. Pageant will ask for password. Enter the password that you have used in step 3. This will add the key in pageant.
pageant-enter-password

Step 9:

Start putty and try to login to your server as root.
ssh-login

Done!! You will get logged in to your server as root user.

Our Top Rated Host

Related Posts