How to Use SSH from cPanel to Access your Site

Website admins cover a wide range of skill levels. For the absolute beginner, cPanel can get a bit overwhelming with all its complicated functions that they will likely never use. On the other end of the spectrum, there are those for whom cPanel is not enough. While it tries to encapsulate the most commonly used functions across a variety of users, there are some things which it simply cannot handle. For these situations, we have SSH. This tutorial will show you how to use SSH from cPanel with step by step screenshots.

Not all hosting providers allow SSH access for all plans. Some like DreamHost allow you to create users from cPanel for it. Others make you specifically ask for it. A few allow you to fill out a form for automatic access. And then there’s SiteGround which provides it by default for all plans! This tutorial isn’t about getting permission to use SSH in the first place. It’s about using the facility if it’s already available.

To use SSH, we need to take the following steps:

  1. Generate a key pair on cPanel
  2. Download and save your private key locally
  3. Get the Hostname and SSH/SFTP Port
  4. Convert the private key to a “.ppk” format
  5. Connect using an SSH client like PuTTy

Here’s a more detailed explanation with screenshots for each of the above steps.

Step 1+ 2+3: Generate a Private Key, Save it, and Get the Credentials

The first three steps are exactly the same as those to enable SFTP. Look at Step 1, Step 2, and Step 3  in this tutorial for details.

Going forward, I will assume that you:

  1. Have saved the private key on your local computer
  2. Have the password for the private key that you generated in Step 1
  3. Know the hostname and port number which is the same for SSH and SFTP

Step 4: Convert the Private Key to a *.ppk Format

To connect via SSH, we need to change the format of the private key that we downloaded to something called “ppk”. To do this, we’re going to use an open source suite of tools called PuTTy. Specifically, we need two tools:

  1. exe to convert the private key to .ppk
  2. exe to connect to the server via SSH

Download both of these files at this location. Here’s a screenshot of the two files you need to download:

Download Putty and Puttygen

Once downloaded, open “puttygen.exe”. Click “Load” in the dialogue box:

Load Private Key we got earlier

Now choose “All Files (*.*)” from the dropdown box and navigate to the location where you stored your private key file in Step 2:

Select the private key we saved

puttygen.exe will ask for your passphrase with which you first created the private key pair in Step 1:

Enter the Passphrase for the Private Key

This will open up the private key file. You can now “Save private key” to save it in a “.ppk” format. Make a note of the location. We’ll need it in the next step.

Step 5: Finally Use SSH from cPanel Using PuTTy

We’re almost there! It’s time to connect to your site via SSH. Open putty.exe and on the left hand side with all the options, expand the “SSH” option and click “Auth” as shown here:

Browse for the ppk Private Key

Click “Browse” on the right hand side and select the .ppk private key file that you generated in Step 4. Once selected, navigate to the “Session” section where you can input your login details. You will need the hostname and port that you got in Step 3:

Enter PuTTy Credentials

(Optional) Save your Settings

If you’re going to do this regularly, it’s a good idea to save your settings in PuTTy so you don’t have to enter all these details and specify the private key file again. To save, enter a name in the “Saved Sessions” box and click “Save”. In the example above, I’ve chosen the name “SiteGround Login”.

Now click “Open” and PuTTy will connect to your server via SSH using the credentials you entered and the private key file that you gave it. You should see a message asking you to add the key to the registry cache like this:

Add Private Key to Server Cache

Hit “Yes” and if all your credentials are correct, the SSH window should open as shown here:

Use SSH from cPanel - Done

Enter your cPanel username, and it’ll ask you for the passphrase for the private key in Step 1. Once you provide all these details, it should connect automatically to the server and you’re done!

So that’s how you use cPanel to connect to your site via SSH. Much of the procedure is the same as that used with SFTP – and indeed, they’re essentially the same. SFTP is just a subsystem of SSH. So if you’ve set up SSH, there’s no reason for you to use normal FTP anymore, which is insecure and dangerous.

I hope you found this useful!

About Bhagwad Park

I've been writing about web hosting and WordPress tutorials since 2008. I also create tutorials on Linux server administration, and have a ton of experience with web hosting products. Contact me via e-mail!

Speak Your Mind