Have a Question?

If you have any question you can ask below or enter what you are looking for!

SSH Keys

SSH (Secure Shell) keys provide a secure way to access your server’s terminal without using passwords. Instead of typing a password each time, you authenticate with a cryptographic key pair. This improves security and convenience, especially for developers and administrators managing hosting environments.

This guide explains:

  • What SSH keys are
  • How to generate SSH keys on different operating systems
  • How to add them to cPanel and Plesk servers for terminal access

What Are SSH Keys?

  • SSH Key Pair: Consists of a public key (shared with the server) and a private key (kept secret on your computer).
  • Authentication: When you connect via SSH, the server checks if your private key matches the stored public key.
  • Security Advantage: Stronger than passwords, resistant to brute-force attacks, and can be encrypted with a passphrase.

Step 1: Generate SSH Keys

On Linux/macOS (OpenSSH)

  1. Open a terminal.
  2. Run:
    • ssh-keygen -t rsa -b 4096 -C "your_email@example.com" OR just ssh-keygen
  3. Press Enter to accept the default location (~/.ssh/id_rsa).
  4. Optionally set a passphrase for extra security.
  5. Keys generated:
    • Private key: ~/.ssh/id_rsa
    • Public key: ~/.ssh/id_rsa.pub

On Windows (PowerShell)

Windows 10 and later include OpenSSH Client by default, so you can generate keys directly in PowerShell:

  1. Open PowerShell as Administrator.
  2. Run the following command: ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. When prompted for a file location, press Enter to accept the default (C:\Users\<YourUser>\.ssh\id_rsa).
  4. Optionally set a passphrase for extra protection.
  5. Keys generated:
    • Private key: C:\Users\<YourUser>\.ssh\id_rsa
    • Public key: C:\Users\<YourUser>\.ssh\id_rsa.pub
  6. To view your public key, run: Get-Content $env:USERPROFILE\.ssh\id_rsa.pub Copy this output — you’ll paste it into cPanel or Plesk.

On Windows (using PuTTYgen)

  1. Download and open PuTTYgen.
  2. Click Generate and move your mouse around to create randomness.
  3. Save the generated keys:
    • Private key: .ppk file
    • Public key: copy from the PuTTYgen window
  4. Optionally, set a passphrase for added protection.
8e6037ec74229eb2dbb09b8570d2e5316a605f49ef54d1de7db433895ca9315b03b1418242823107?t=8f6c48e43af88038d7c0eb45f965cf14

Step 2: Add SSH Public Key in cPanel

  1. Log in to cPanel.
  2. Navigate to Security → SSH Access.
  3. Click Manage SSH Keys.
  4. Choose Import Key (to upload the public key).
    • Enter a name for your key.
    • Paste your public key (id_rsa.pub) into the provided field.
    • Leave the private key field blank.
  5. Click Import.
  6. Go back to Manage SSH Keys, locate your key
  7. Authorize the key by clicking Manage Authorization.

Once authorized, you can connect via terminal: ssh -p22 user@yourserverIPaddress

Step 3: Adding SSH Key in Plesk for authentication

  1. Log in to Plesk.
  2. Go to Websites & Domains.
  3. On the right-hand side, click SSH Keys.
  4. In the SSH Keys Manager, click Add Key.
  5. Paste your public key (id_rsa.pub) into the field.
  6. Click Add.
  7. Note your system user and server IP address from the subscription details.
  8. Connect via SSH using: ssh systemuser@server-ip

Best Practices

  • Keep your private key secure: Never share it.
  • Use strong algorithms: Prefer ed25519 or rsa -b 4096.
  • Restrict access: Ensure only authorized users can access your .ssh directory.
    • Use strong permissions on your .ssh directory (chmod 700 ~/.ssh).
  • Remove unused or old keys from cPanel/Plesk to reduce risk.

By generating SSH keys locally and adding the public key to cPanel or Plesk, you can securely access your server’s terminal without passwords. This method improves security and streamlines workflows for developers and administrators.

Got stuck?

Open a ticket in the customer portal or email cloudabove.com/contact-us for further help