SSH Keys
SSH keys let you connect to your account over the command line without typing a password, and they are far more secure than passwords alone. This guide covers generating a key pair in cPanel, authorizing it, downloading the private key, and connecting with it.
Why Keys Beat Passwords
An SSH key pair is made of two parts: a public key that lives on the server and a private key that stays on your computer. When you connect, the two are matched cryptographically.
- A strong key is effectively impossible to guess or brute-force, unlike a password.
- Your private key never travels across the network, so it cannot be intercepted.
- You can add a passphrase to the private key, so a stolen laptop still doesn't grant access.
Generating a Key Pair
- Log into cPanel.
- Go to Security → SSH Access, then click Manage SSH Keys.
- Click Generate a New Key.
- Give the key a name (or accept the default
id_rsa) and set a strong passphrase. The passphrase protects the private key if it is ever copied. - Choose a key type and size (RSA 4096 is a solid default) and click Generate Key.
Authorizing the Public Key
A newly generated key is not active until you authorize its public half:
- Back on the Manage SSH Keys page, find your new key under Public Keys.
- Click Manage next to it.
- Click Authorize.
The key now shows as authorized, which means the server will accept connections signed by the matching private key.
Downloading the Private Key
- Under Private Keys, click View/Download next to your key.
- Click Download Key and save the file to your computer, typically into your
~/.ssh/folder.
Converting the Key for PuTTY
On Windows, the popular PuTTY client needs the key in its own .ppk format:
- Open PuTTYgen (installed alongside PuTTY).
- Click Load, change the file filter to All Files, and open the private key you downloaded.
- Enter the passphrase when prompted.
- Click Save private key to write out a
.ppkfile. - In PuTTY, point Connection → SSH → Auth at that
.ppkfile when you connect.
Connecting Without a Password
With the key authorized and downloaded, connect from a terminal on macOS, Linux, or Windows using your cPanel username and the server's hostname on port 22:
ssh -i ~/.ssh/id_rsa [email protected]
You will be asked for the key's passphrase (not your account password) the first time. SSH connects as the cPanel user on port 22. Replace cpuser with your cPanel username and server.example.com with your server hostname.