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
-
Log in to cPanel
Start by logging into your cPanel account. -
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.
-
Manage SSH Keys
On the SSH Access page, click on Manage SSH Keys. -
Generate New Key
Click on the Generate New Key button. -
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.
- Key Name: Confirm the key name (default is
-
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). -
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
-
Log in to cPanel
Log into your cPanel account. -
Open SSH Access Tool
Navigate to the Security section and click on SSH Access. -
Manage SSH Keys
Click on Manage SSH Keys under the SSH Access page. -
Import Key
Click on Import Key. -
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.
- Enter a name for the key (defaults to
-
Import the Key
Click Import. After importing, you’ll see the key listed under Public Keys. -
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:
-
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.
-
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.
-
Connect
Double-click the saved session in PuTTY to connect without a password prompt.
Using Windows 10 Native SSH Client:
-
Download the Private Key
- Download and save the private key (
id_rsa
) on your local machine.
- Download and save the private key (
-
Open Command Prompt
Press Windows Key + R, typecmd
, and hit Enter. -
Run SSH Command
Type the following in the command prompt:(Replace
C:\path\to\id_rsa
with the actual path where the key is saved, and[email protected]
with your details). -
Connect
If it's your first time connecting, you’ll be prompted to confirm the fingerprint by typing Yes.