How to Connect Over SSH to a Server with cPanel

There are many a times where you need to connect to your hosting server through shell or terminal (mac) to perform functions like pull/push you code when using code versioning tools like Github or Bitbucket. I remember during our initials days of development at Varshyl Technologies we used FTP client to code deployment or updates to applications. But as we grew bigger both in terms of team size and project, dev needed to work in collaboration and started using tools that supported secure, collaborative development environments. Using SSH we ensured all deployments were secured and Bitbucket enabled team to work in collaboration.

I have worked on different cloud platforms and servers with web hosting control panel like cPanel and Plesk. In this post, I will focus just on how one can connect to a server with cPanel using SSH and deploy codes or perform other functions.

Step1 — Generate ssh key pair (public/private key) — Windows

For this open puttygen, and click generate. It will ask you to move your mouse in blank space to generate the key. Once generated it will display Public Key and option to save Private Key.

a) Login name — first in Key Comment we will enter the name we want to use to login to VM.

b) save private key — click save private key. (save at any location of your choice, just remember it as you will need to choose it every-time you connect to server.

 

connecting SSH to a server

 

Step2 — Import public key from step1 in cPanel

Login into your cPanel account and click SSH Access

  • Click on Manage SSH Keys
  • Click on Import Key
  • Enter name (optional but help you identify later, if you need to setup access for multiple users)
  • Paste public key (copied from Step1 above — generated using Puttygen)
  • Click Import
  • Now before you can access, you need to Authorize the key. In list Public keys, for the key you just added, click Manage
  • Click Authorize

That’s It, now you are all set to access the server using Putty.

 

SSH access

I have already done a separate article on how to access SSH using putty. For next set of steps click here

Please note by default SSH uses port 22 but many hosting companies uses custom port, so do check with your host on which port to use.

Login Name — it will be your cPanel login name

Alright! hope this help someone who is trying to setup and access their server using SSH.

Author

  • Entrepreneur and Technology Enthusiast | Started Varshyl Technologies, a web and mobile application development company, helping companies build and promote their digital presence. Co-founded Snapworks - a mobile first communication platform for schools. Outside VT, enjoys his morning workouts, reading biographies and golf.