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 WindowsHow to upload and authorize the key in cPanelHow to connect to your server using SSHWhy SSH asks for a verification codeHow to troubleshoot common SSH errorsLet’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 WindowsWindows 10 and Windows 11 come with built-in OpenSSH support.Step 1: Check If SSH Key Already ExistsOpen PowerShell and run:ls ~/.ssh If you see:id_ed25519id_ed25519.pubThe 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 cPanelIf you’re using shared hosting:Login to cPanelGo to Security → SSH AccessClick Manage SSH KeysClick Import KeyPaste your public keyClick ImportAfter importing:Click ManageClick AuthorizeWithout authorization, SSH login will fail.How to Connect to Your Server Using SSHOnce 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 AuthenticatorMicrosoft AuthenticatorAuthyOpen 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 Fixes1️⃣ Permission Denied (publickey)Possible causes:Key not authorized in cPanelWrong usernameWrong private keyWrong SSH portFix:Re-authorize the keyDouble-check usernameConfirm private key path2️⃣ Connection Timed OutPossible causes:Wrong IP addressSSH port blockedFirewall restrictionFix:Confirm correct server IPCheck with hosting supportVerify port number3️⃣ Host Key Verification FailedFix: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 SecurityAlways use SSH keys instead of passwordsDisable password authentication (on VPS)Enable firewallUse non-default SSH port (optional)Enable Two-Factor AuthenticationNever share private keyFrequently 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 ThoughtsSSH 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. Post navigation Redis vs Memcached – Complete Guide, Differences & Setup (2026)