How to Secure Your cPanel Server With SSH Keys And Public Key Cryptography
Introduction
SSH keys provide a secure way to authenticate access to servers. Using cPanel's built-in SSH Access tool, you can generate, authorize, and download your SSH key pair easily. This guide walks you through the steps to create and manage your SSH keys for secure server connections.
Prerequisites
- Access to your cPanel account.
- Basic understanding of SSH and server access.
- A secure method to store the password and keys.
Steps to Generate SSH Key Pair
Navigate to the SSH Access Tool:
-
Log in to cPanel.
- Under the Security section, select SSH Access.
- Click on Manage SSH Keys to proceed.
Create a New Key Pair:
- Click Generate New Key.
-
Provide a name for the key or use the default (id_rsa).
-
Set a strong password for added security. Make sure to save it securely, as it cannot be retrieved later.
- Click Generate Key to create the key pair.
Authorize the Public Key:
- Return to the Manage SSH Keys interface.
- Locate your newly created key under the Public Keys section.
- Click Manage next to the key, and then select Authorize.
Downloading the Private Key
Access Private Keys in cPanel:
- Go to the Manage SSH Keys section again.
- Scroll to the Private Keys area and find the key you created.
- Click View/Download next to the key.
- Click the Download Key button below the displayed key.
- Save the key to a secure location on your computer.
Store Private Key
-
Move the downloaded private key to a safe location on your local machine.
- For Linux/Mac, place it in
/home/username/.ssh
.
Use SSH Key to Connect (Linux/Mac)
- On Linux or Mac, use the following command to connect:
Example:
ssh -i path_of_stored_key user@email.com
Note: Relace
path_of_stored_key
with Actual Path
Using PuTTY (Windows)
-
Convert the private key to PPK format using cPanel’s Convert option.
- Download the PPK file and use it to connect with PuTTY.
Enhanced Security
SSH keys enhance server security by preventing login with weak passwords. Consider disabling password-based logins entirely for additional security.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS