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:
cat ~/.ssh/id_rsa.pubFor Windows
Run the following command in Command Prompt or 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:
ssh-rsa AAfdsfEAAAADAQABAAACAQDDC9E5TrOBnBjsCVL4KwMkbbHXsF//mjvArN/pXF0ciborNorqDB95kFSwBfbP1SEf/iFPjszO8lm4C5fVBhfdgfdgI5cIzRazS1cP4+EOIXGwFwv+efI5v+svU4vnm1416FU1eAc0yvqWzlxMnPejAdyCQIlP40cDhUyv84Z2Og1Aj6r2oleKNiDmE6L+jkauHx8zjSrJDknOaEilmmVxZ3s2RQyCW0515eHPfCQ95m53ccNCSLA+X3B4keNLiqP6IdW31vwp3XbGBNUR2OniU1VIQt9IJulmks5yFih28mH1oFjH7eNOvnf9ybNueoCvi7af5YDBQQwNKe/wP6maTgjq2/hBfRPD1Cp6X7zVzdfdsfP5HL4KWWnPpzFSc20peT8Bc8kEQPWbMW9K+rG0eEMgVz0a6phPAFd8SJ9nYWNS3BWUt0YMWzDeR2PeYbvGmi7ri1RIo1Hlwzbi+qFeMEA1KLIGolMekNpU7+tHqEIsu7kGk9to1SLOksphOY/qISw== kashifwahaj@gmail.comSelect and copy the entire string from the terminal to your clipboard.
Step 2: Import Key into Shared Hosting Panel
- Log in to your hosting control panel (e.g. cPanel, Plesk, Hostinger, SiteGround).
- Search for SSH Access or SSH Keys in the dashboard.
- Click Import Key (or Add SSH Key).
- Enter any descriptive name (e.g.
work-macbookorhome-pc). - Paste your copied public key into the Public Key textarea.
- Click Import / Save.
- 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.comor your domain) - SSH Username: (usually your cPanel/hosting username)
- SSH Port: (often non-standard on shared hosts, e.g.
2222or21098instead of default22)
Now open your local terminal and connect:
ssh username@hostname -p portFor example:
ssh myuser@shared102.webhost.com -p 2222You 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.