Password logins are the weakest point of most servers. Every public VPS sees constant automated attempts to guess SSH passwords. SSH keys remove that risk: authentication uses a cryptographic key pair, the secret half never leaves your computer, and there is no password to guess. Once keys work, you can turn password authentication off completely.
This guide covers all three desktop platforms, the safe order of steps so you never lock yourself out, and the permission problems that make key logins silently fail.
How SSH Keys Work
- The private key (for example
~/.ssh/id_ed25519) stays on your computer. Anyone holding it can log in as you, so protect it with a passphrase. - The public key (
id_ed25519.pub) is safe to share. You place it in~/.ssh/authorized_keyson each server. - When you connect, the server challenges your client to prove it holds the matching private key. No secret is sent over the network.
Ed25519 is the recommended key type today: short keys, fast, and strong. Use RSA (with at least 3072 bits) only for very old systems that do not support Ed25519.
Step 1a: Generate a Key on macOS or Linux
ssh-keygen -t ed25519 -C "you@laptop-2026"
Accept the default location (~/.ssh/id_ed25519) and enter a passphrase. The -C comment just labels the key so you can recognise it later in authorized_keys.
Step 1b: Generate a Key on Windows 10 or 11
Windows includes the OpenSSH client. Open PowerShell and run the same command:
ssh-keygen -t ed25519 -C "you@windows-pc"
Keys are saved in C:\Users\YourName\.ssh\. If ssh is not recognised, add the "OpenSSH Client" optional feature in Settings. PuTTY users can generate keys with PuTTYgen, but PuTTY's .ppk format must be converted for OpenSSH; using the built-in OpenSSH client avoids that step.
Step 2: Copy the Public Key to the VPS
On macOS and Linux, ssh-copy-id appends the key and sets correct permissions:
ssh-copy-id -i ~/.ssh/id_ed25519.pub admin@203.0.113.10
Windows does not ship ssh-copy-id. This PowerShell one-liner does the same job:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh admin@203.0.113.10 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
Both methods ask for the account password one last time. If the server already has password logins disabled, add the key through your provider's web console instead, by pasting the contents of the .pub file into ~/.ssh/authorized_keys.
Step 3: Test Key Login Before Changing Anything
ssh -i ~/.ssh/id_ed25519 admin@203.0.113.10
You should be asked for the key's passphrase (a local prompt), not the server password. If you are still asked for the server password, the key was not accepted; jump to the troubleshooting section before going further.
Step 4: Use a Non-Root Admin User
Log in as a normal user with sudo rather than as root. If you only have root, create a user and copy your key to it:
adduser admin
usermod -aG sudo admin
mkdir -p /home/admin/.ssh
cp /root/.ssh/authorized_keys /home/admin/.ssh/
chown -R admin:admin /home/admin/.ssh
chmod 700 /home/admin/.ssh && chmod 600 /home/admin/.ssh/authorized_keys
Test ssh admin@server and sudo -v in a new terminal before continuing.
Step 5: Disable Password Logins
Keep your current session open. On Ubuntu and Debian, create a drop-in file so package updates do not overwrite your change:
sudo tee /etc/ssh/sshd_config.d/00-hardening.conf >/dev/null <<'EOF'
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
EOF
sudo sshd -t && sudo systemctl reload ssh
sshd -t checks the configuration for errors before you reload. On some distributions the service is called sshd instead of ssh. Then, from a new terminal, confirm that key login still works and that password login is refused:
ssh admin@203.0.113.10
ssh -o PubkeyAuthentication=no admin@203.0.113.10 # should fail: Permission denied (publickey)
Check for files that might override your setting with sudo sshd -T | grep -i passwordauthentication. OpenSSH uses the first value it reads for each setting, and files in sshd_config.d/ are read in alphabetical order. Some cloud images ship a file such as 50-cloud-init.conf that sets PasswordAuthentication yes, which is why the example file is named 00- so it is read first. If the effective value is still yes, find the conflicting file with sudo grep -ri passwordauthentication /etc/ssh/.
Step 6: Make Logins Convenient
An SSH config file saves typing. Create or edit ~/.ssh/config (on Windows, C:\Users\YourName\.ssh\config):
Host myvps
HostName 203.0.113.10
User admin
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
Now ssh myvps is all you need, and tools such as scp, rsync, Git and VS Code Remote-SSH use the same entry.
To avoid typing the passphrase every time, use the SSH agent:
# macOS / Linux
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Windows (PowerShell as Administrator, once)
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
# then, as your normal user
ssh-add $env:USERPROFILE\.ssh\id_ed25519
Managing Several Keys and Devices
- Create one key per device (laptop, desktop, CI system) rather than copying one private key around. If a device is lost, remove just its line from
authorized_keys. - Label keys with
-Cso each line inauthorized_keysis identifiable. - For CI/CD deploy keys, create a dedicated key without shell privileges where possible, and store it in the CI secret store, never in the repository.
- Keep a backup of your private key (with its passphrase) in a password manager, or have a second authorised key, so losing one laptop does not lock you out.
SkyRainCloud Plans for This Workload
SSH keys work the same on every plan. Every SkyRainCloud Linux VPS includes full root access, so you can add keys and change the SSH configuration yourself.
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.
Troubleshooting Key Logins
Run the client in verbose mode to see what it offers: ssh -v admin@server. On the server, read the reason in the log: sudo journalctl -u ssh -n 50 (or /var/log/auth.log).
| Problem | Fix |
|---|---|
| "Authentication refused: bad ownership or modes" | chmod 700 ~/.ssh, chmod 600 ~/.ssh/authorized_keys, and make sure the home directory is not group- or world-writable |
| Still asked for the server password | Public key not in the right user's authorized_keys, or a line break inside the key line |
| "UNPROTECTED PRIVATE KEY FILE" on Windows | The private key file is readable by other users; restrict its permissions to your account only |
| "Too many authentication failures" | The agent offers many keys; set IdentitiesOnly yes and IdentityFile in ~/.ssh/config |
| Locked out after disabling passwords | Use the provider's web console to fix authorized_keys or re-enable passwords temporarily |
Frequently Asked Questions
Which SSH key type should I use?
Is it safe to share my public key?
.pub) is designed to be placed on servers and shared. Never share the private key file.Should I set a passphrase on my SSH key?
How do I copy an SSH key from Windows without ssh-copy-id?
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh user@server "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys", then fix permissions to 700 and 600.Will disabling password authentication lock me out?
Why does SSH still ask for my server password?
~/.ssh, the key added to a different user, or the client offering a different key. Run ssh -v and check the server's auth log.Can I use the same key for several servers?
Should I change the default SSH port?
How do I remove access for a lost laptop?
~/.ssh/authorized_keys on every server. Labelling keys with -C makes the right line easy to find.Can I use SSH keys on a SkyRainCloud VPS?
authorized_keys and harden the SSH configuration as described above.