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.
Download and install PuTTY 1.
Note: Even if you currently have PuTTY installed, check to see if there is a newer version available.
After installation, open the PuTTY Key Generator.
To generate the key, move the mouse around in the blank area while the key is generating.
Change the “Key comment” to your personal e-mail address. Avoid email addresses that start with users like admin@ or support@.
The key will look something like RSA-key-20131204, change it to [email protected].
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.
Copy the entire public key and paste it in a text file, you’ll need this shortly.
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
Importing SSH key via WHM/cPanel
Edit the .ppk file in notepad or notepad++ (enter the password when requested).
Log in to WHM/cPanel using root and the root password in your server details email.
In the Search section, enter “SSH” in the text box.
Click on Manage root’s SSH Keys
Leave the “Choose a name for this key (defaults to id_dsa):” blank.
Enter the .ppk passphrase in the next field.
From the opened .ppk file, copy the entire contents of the file and paste in the Private Key area.
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]
Paste in the Public Key text field and select Import.
Importing SSH Key via root Access
Under the Sessions menu, input the IP address of the Server.
Make sure that the SSH button is selected.
Use root as the login name.
Enter the root password.
Edit the authorized_key file by utilizing the following command nano .ssh/authorized_keys
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.
Press Ctrl+X and then Y to save this entry.
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:
Open PuTTY and go to SSH >> Auth
Browse to your Private Key on your computer.
Open it. (the file location will be listed if done properly)
Go back to Session and highlight Default Settings and click Save.
Now you can connect using the IP address and using port 22.
Connecting with Mac OS X or Linux
Open a terminal session.
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