Skip to main content
All CollectionscPanel
SSH Access - cPanel VPS
SSH Access - cPanel VPS
Updated over a week ago

There are many ways to connect to your cPanel/Linux VPS, however, probably the most versatile will be utilizing SSH. This will place powerful command line tools at your fingertips. We will be covering the steps to securely connect to your VPS with SSH.

Generate Private SSH Key

Setting up a Private SSH Key will allow you to remote into your Linux VPS and better manage/automate your server and processes.

Key Generation

  1. Download and install PuTTY 1.

  2. Note: Even if you currently have PuTTY installed, check to see if there is a newer version available.

  3. After installation, open the PuTTY Key Generator.

  4. Click Generate.

  5. To generate the key, move the mouse around in the blank area while the key is generating.

  6. Change the “Key comment” to your personal e-mail address. Avoid email addresses that start with users like admin@ or support@.

  7. The key will look something like RSA-key-20131204, change it to [email protected].

  8. Enter a strong passphrase ( find help here with creating a strong password ) and confirm it. The key should meet strict password standards. Store or memorize this passphrase.

  9. Copy the entire public key and paste it in a text file, you’ll need this shortly.

  10. Click Save public key to a location you’ll remember. Save as the first part of your e-mail address, e.g. user.ppk

Importing Private SSH Key

<d

Importing SSH key via WHM/cPanel

  1. Edit the .ppk file in notepad or notepad++ (enter the password when requested).

  2. Log in to WHM/cPanel using root and the root password in your server details email.

  3. In the Search section, enter “SSH” in the text box.

  4. Click on Manage root’s SSH Keys

  5. Leave the “Choose a name for this key (defaults to id_dsa):” blank.

  6. Enter the .ppk passphrase in the next field.

  7. From the opened .ppk file, copy the entire contents of the file and paste in the Private Key area.

  8. Create your Key: take ssh-rsa from the top of the file and put in front of the Public Key and take the user in the comment: and put it at the end of the Public Key. You should end up with something similar to below:                                                                                                                                                                                                    ssh-rsa AAAAAAEWdddjhfe9dFFFkeid99KKd...bunch of characters(no spaces here)...RID444KdddDIkeidA= [email protected]                                                           

  9. Paste in the Public Key text field and select Import.

Importing SSH Key via root Access

  1. Open PuTTY

  2. Under the Sessions menu, input the IP address of the Server.

  3. Make sure that the SSH button is selected.

  4. Click Open.

  5. Use root as the login name.

  6. Enter the root password.

  7. Edit the authorized_key file by utilizing the following command                                                                                                                                                                   nano .ssh/authorized_keys                                                                                                   

  8. Using the key you generated above (the one you placed ssh-rsa in front of ) add your key to the file on a single line.

  9. Press Ctrl+X and then Y to save this entry.

  10. Run the following command to restart the ssh service:                                                                                                                                                                                        service sshd restart

Connecting with Private SSH Key

Once you have your public SSH key setup on the server you can use your private key to connect using one of the methods below:

Using PuTTY with Windows:

  1. Open PuTTY and go to SSH >> Auth

  2. Browse to your Private Key on your computer.

  3. Open it. (the file location will be listed if done properly)

  4. Go back to Session and highlight Default Settings and click Save.

  5. Now you can connect using the IP address and using port 22.

Connecting with Mac OS X or Linux

  1. Open a terminal session.

  2. Use the following command: 

ssh -p $port $user@$IP

$port - replace this with the port number (typically 22)
$user - replace this with your username (first part of your ppk file)
$IP - replace this with the IP address of your server

Did this answer your question?