How to Configure SSH Keys in cPanel Print

  • 0

What Does Enabling SSH Access Allow?

  • Remote Hosting Control: You can add, remove, edit, backup, and restore hosting files and directories remotely.
  • Server-to-Server Connections: Establish secure connections between two different servers.
  • Database Management: Import and export databases securely.

Steps to Configure SSH Keys in cPanel

You can either generate a new SSH key pair or import an existing one. Below are the steps for both options.


Option 1: To Generate a New SSH Key

  1. Log in to cPanel
    Start by logging into your cPanel account.

  2. Open SSH Access Tool

    • For Jupiter Theme: Go to the Tools page, then under the Security section, click on SSH Access.
    • For Paper Lantern Theme: Look under the Security section on the cPanel home page and click on SSH Access.
  3. Manage SSH Keys
    On the SSH Access page, click on Manage SSH Keys.

  4. Generate New Key
    Click on the Generate New Key button.

  5. Configure the Key

    • Key Name: Confirm the key name (default is id_rsa).
    • Password: Enter a password for the key, and re-enter it to confirm. You can use the password generator for a strong password.
    • Key Type: Set the key type to RSA.
    • Key Size: Ensure the key size is set to 2048.
  6. Generate Key
    Once all settings are configured, click Generate Key. cPanel will generate both public and private keys and store them in /home/username/.ssh directory (replace "username" with your cPanel account name).

  7. Authorize the Key
    After generating the key, click on Go Back. Under the Public Keys section, locate the newly generated key. Click Manage, then click Authorize to enable the key for SSH access.


Option 2: Importing an Existing SSH Key

  1. Log in to cPanel
    Log into your cPanel account.

  2. Open SSH Access Tool
    Navigate to the Security section and click on SSH Access.

  3. Manage SSH Keys
    Click on Manage SSH Keys under the SSH Access page.

  4. Import Key
    Click on Import Key.

  5. Enter Key Name and Public Key

    • Enter a name for the key (defaults to id_dsa).
    • Paste the public key text into the Paste the public key box.
  6. Import the Key
    Click Import. After importing, you’ll see the key listed under Public Keys.

  7. Authorize the Key
    Click Manage under Actions for the newly imported key. Then click Authorize and Go Back.


How to Connect to Your Account Using SSH Keys

For Windows OS

Using PuTTY:
Follow these steps to connect via PuTTY with the SSH key:

  1. Download the Private Key

    • In cPanel, go to SSH Access > Manage SSH Keys.
    • Under Private Keys, find the key name you created and click View/Download.
    • Click Convert to convert the key into .ppk format for PuTTY.
    • Download and save the .ppk file to your local computer.
  2. Configure PuTTY

    • Open PuTTY and expand SSH, then click on Auth.
    • Under Authentication Parameters, click Browse and select the .ppk file you saved.
    • In Session, type [email protected] (replace with your cPanel username and domain).
    • Set the Port to 7822, and make sure Connection Type is set to SSH.
    • Save the session for future use by typing a name under Saved Sessions and clicking Save.
  3. Connect
    Double-click the saved session in PuTTY to connect without a password prompt.

Using Windows 10 Native SSH Client:

  1. Download the Private Key

    • Download and save the private key (id_rsa) on your local machine.
  2. Open Command Prompt
    Press Windows Key + R, type cmd, and hit Enter.

  3. Run SSH Command
    Type the following in the command prompt:

    ssh -p 7822 -i C:\path\to\id_rsa [email protected]

    (Replace C:\path\to\id_rsa with the actual path where the key is saved, and [email protected] with your details).

  4. Connect
    If it's your first time connecting, you’ll be prompted to confirm the fingerprint by typing Yes.


Was this answer helpful?

« Back