How to Generate and Use SSH key on a cPanel Server


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


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.

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.

Step 4:

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

Step 5:

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

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

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.

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.

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.

Step 9:

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

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

Our Top Rated Host

Related Posts