SSH Access in Windows & cPanelSSH Access in Windows & cPanel

Secure Shell (SSH) is one of the most important tools for securely accessing and managing servers. Whether you are using shared hosting with cPanel or a VPS, understanding SSH key authentication and server login is essential for security and performance.

In this complete guide, you will learn:

  • How to generate an SSH public key in Windows
  • How to upload and authorize the key in cPanel
  • How to connect to your server using SSH
  • Why SSH asks for a verification code
  • How to troubleshoot common SSH errors

Let’s get started.


What Is SSH?

SSH (Secure Shell) is a cryptographic network protocol that allows secure communication between your computer and a remote server.

Instead of using passwords, SSH keys provide a safer authentication method by using:

  • Private Key (stored securely on your computer)
  • Public Key (stored on the server)

This eliminates brute-force password attacks and improves server security.


How to Generate SSH Public Key in Windows

Windows 10 and Windows 11 come with built-in OpenSSH support.

Step 1: Check If SSH Key Already Exists

Open PowerShell and run:

ls ~/.ssh

If you see:

  • id_ed25519
  • id_ed25519.pub

The file ending in .pub is your public key.


Step 2: Generate a New SSH Key (If Not Found)

Run:

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter to accept the default location.

Your keys will be saved in:

C:\Users\YourUsername\.ssh\

To view your public key:

cat ~/.ssh/id_ed25519.pub

Copy the entire output.

⚠️ Never share your private key (file without .pub).


How to Upload SSH Public Key in cPanel

If you’re using shared hosting:

  1. Login to cPanel
  2. Go to Security → SSH Access
  3. Click Manage SSH Keys
  4. Click Import Key
  5. Paste your public key
  6. Click Import

After importing:

  1. Click Manage
  2. Click Authorize

Without authorization, SSH login will fail.


How to Connect to Your Server Using SSH

Once your key is authorized, connect using PowerShell.

Basic Connection:

ssh username@server-ip

Example:

ssh tabsheer@123.45.67.89

If Using a Custom Port:

ssh -p 2222 username@server-ip

If Using a Specific Private Key:

ssh -i C:\Users\YourUsername\.ssh\id_ed25519 username@server-ip

Why Is SSH Asking for a Verification Code?

If you see:

Verification code:

This means Two-Factor Authentication (2FA) is enabled on your hosting account.

The verification code comes from an authenticator app like:

  • Google Authenticator
  • Microsoft Authenticator
  • Authy

Open the app on your phone and enter the 6-digit code.

If you did not enable 2FA, contact your hosting provider.


Common SSH Errors and Fixes

1️⃣ Permission Denied (publickey)

Possible causes:

  • Key not authorized in cPanel
  • Wrong username
  • Wrong private key
  • Wrong SSH port

Fix:

  • Re-authorize the key
  • Double-check username
  • Confirm private key path

2️⃣ Connection Timed Out

Possible causes:

  • Wrong IP address
  • SSH port blocked
  • Firewall restriction

Fix:

  • Confirm correct server IP
  • Check with hosting support
  • Verify port number

3️⃣ Host Key Verification Failed

Fix:

ssh-keygen -R server-ip

Then reconnect.


How to Copy SSH Public Key to Clipboard (Windows)

Quick command:

Get-Content ~/.ssh/id_ed25519.pub | Set-Clipboard

Now paste it directly into cPanel or Git repository.


Best Practices for SSH Security

  • Always use SSH keys instead of passwords
  • Disable password authentication (on VPS)
  • Enable firewall
  • Use non-default SSH port (optional)
  • Enable Two-Factor Authentication
  • Never share private key

Frequently Asked Questions (FAQ)

What is SSH public key used for?

It allows secure login to a server without typing a password.

Can I use SSH on shared hosting?

Yes, if your hosting provider allows SSH access.

Where are SSH keys stored in Windows?

Inside:

C:\Users\YourUsername\.ssh\

Is SSH secure?

Yes, when using key-based authentication and proper security practices.


Final Thoughts

SSH is a powerful and secure way to manage servers. Whether you’re working with shared hosting through cPanel or managing a VPS, using SSH keys significantly improves security and efficiency.

Once configured properly, you can log in instantly without passwords and safely manage your website or server environment.

Leave a Reply

Your email address will not be published. Required fields are marked *