Setup SSH Locally in Shared Hosting Environment

Easily connect your shared hosting server using SSH locally using these setup steps.

1 min read

Connecting to a shared hosting environment via SSH gives you terminal access for Git deployments, running Composer or npm, and managing files much faster than FTP or cPanel File Manager.

Here is a step-by-step walkthrough to generate your local SSH key, import it into your hosting panel (such as cPanel, Plesk, or DirectAdmin), and establish a secure shell connection from your local terminal.


Step 1: Get Your Local SSH Key

First, verify if you already have an existing public SSH key on your machine.

For Linux and macOS

Run the following command in your terminal to output your public key:

terminal
cat ~/.ssh/id_rsa.pub

For Windows

Run the following command in Command Prompt or PowerShell:

cmd / powershell
type C:\Users\USERNAME\.ssh\id_rsa.pub

(Replace USERNAME with your Windows user folder name).


Copy Your Public Key

The output will start with ssh-rsa and look similar to this:

public key
ssh-rsa AAfdsfEAAAADAQABAAACAQDDC9E5TrOBnBjsCVL4KwMkbbHXsF//mjvArN/pXF0ciborNorqDB95kFSwBfbP1SEf/iFPjszO8lm4C5fVBhfdgfdgI5cIzRazS1cP4+EOIXGwFwv+efI5v+svU4vnm1416FU1eAc0yvqWzlxMnPejAdyCQIlP40cDhUyv84Z2Og1Aj6r2oleKNiDmE6L+jkauHx8zjSrJDknOaEilmmVxZ3s2RQyCW0515eHPfCQ95m53ccNCSLA+X3B4keNLiqP6IdW31vwp3XbGBNUR2OniU1VIQt9IJulmks5yFih28mH1oFjH7eNOvnf9ybNueoCvi7af5YDBQQwNKe/wP6maTgjq2/hBfRPD1Cp6X7zVzdfdsfP5HL4KWWnPpzFSc20peT8Bc8kEQPWbMW9K+rG0eEMgVz0a6phPAFd8SJ9nYWNS3BWUt0YMWzDeR2PeYbvGmi7ri1RIo1Hlwzbi+qFeMEA1KLIGolMekNpU7+tHqEIsu7kGk9to1SLOksphOY/qISw== kashifwahaj@gmail.com

Select and copy the entire string from the terminal to your clipboard.


Step 2: Import Key into Shared Hosting Panel

  1. Log in to your hosting control panel (e.g. cPanel, Plesk, Hostinger, SiteGround).
  2. Search for SSH Access or SSH Keys in the dashboard.
  3. Click Import Key (or Add SSH Key).
  4. Enter any descriptive name (e.g. work-macbook or home-pc).
  5. Paste your copied public key into the Public Key textarea.
  6. Click Import / Save.
  7. If your hosting requires manual authorization, click Manage next to the imported key and select Authorize.

Step 3: Connect from Local Terminal

In your hosting panel’s SSH section, locate your connection credentials:

  • Hostname / Server IP: (e.g. server123.hosting.com or your domain)
  • SSH Username: (usually your cPanel/hosting username)
  • SSH Port: (often non-standard on shared hosts, e.g. 2222 or 21098 instead of default 22)

Now open your local terminal and connect:

terminal
ssh username@hostname -p port

For example:

terminal
ssh myuser@shared102.webhost.com -p 2222

You are now connected to your shared hosting environment via SSH!


Questions or Feedback?

If you encounter any issues or have questions regarding shared hosting SSH configurations, reach out at kashifwahaj@gmail.com.