SSH (Secure Shell) keys provide a secure way to access your hosting account without using a password. Instead, authentication is handled through a public/private key pair. cPanel makes it easy to generate, manage, and authorize SSH keys.

 

Why Use SSH Keys?

  • Stronger security than passwords.

  • Prevents brute‑force login attempts.

  • Convenient for developers who frequently access servers.

  • Required for some automated deployments and Git operations.

 

Steps to Generate and Configure SSH Keys in cPanel

1. Generate a New Key Pair

  1. Log in to cPanel.

  2. On the Tools page → Security section, click SSH Access.

  3. Click Manage SSH Keys.

  4. Under Generate a New Key, fill in:

    • Key Name → Optional identifier (default: id_rsa).

    • Key Password → Protects your private key.

    • Key Type → RSA recommended.

    • Key Size → Choose 2048 or 4096 bits (larger = stronger security).

  5. Click Generate Key.

  6. The key pair is created and stored on the server.

 

2. Authorize the Public Key

  1. In Manage SSH Keys, locate the key you generated.

  2. Click Manage Authorization.

  3. Click Authorize → the public key is now trusted for SSH access.

 

3. Download the Private Key

  1. In Manage SSH Keys, locate your key.

  2. Click View/Download.

  3. Copy or download the private key to your local machine.

  4. Save it securely (e.g., ~/.ssh/id_rsa).

  5. Adjust file permissions:

    chmod 600 ~/.ssh/id_rsa
    
     

4. Connect Using SSH

  1. Open a terminal (Linux/macOS) or use PuTTY (Windows).

  2. Run:

    ssh -i ~/.ssh/id_rsa username@hostname
    
    Replace username with your cPanel username.
    • Replace hostname with your server’s domain or IP.

 

Notes

  • Always keep your private key secure, never share it.

  • Use 4096‑bit keys for maximum security.

  • If you lose your private key, you must generate a new pair.

  • You can import existing public keys into cPanel if you already use SSH elsewhere.

 
Hai trovato utile questa risposta? 0 Utenti hanno trovato utile questa risposta (0 Voti)

Powered by WHMCompleteSolution