← Blog

SSH Keys: Log In to Your VPS Without Passwords

October 12, 2026 · 5 min read

Passwords can be guessed, phished or reused. An SSH key can't. Switching your server to key-based login is the single most effective security step you can take — and it takes five minutes.

1. Create a key on your computer

On Linux, macOS, and Windows 10/11 (PowerShell has OpenSSH built in):

ssh-keygen -t ed25519 -C "my-laptop"

Press Enter to accept the default location and set a passphrase. This creates a private key (keep it secret) and a public key ending in .pub (safe to share).

2. Copy the public key to the server

From Linux or macOS:

ssh-copy-id root@YOUR_SERVER_IP

From Windows PowerShell:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@YOUR_SERVER_IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

3. Test it

ssh root@YOUR_SERVER_IP

You should get in without the server's password. Keep this session open while you do the next step.

4. Turn off password logins

Edit the SSH config:

nano /etc/ssh/sshd_config

Set:

PasswordAuthentication no

One gotcha: on Ubuntu cloud images a file in /etc/ssh/sshd_config.d/ (often 50-cloud-init.conf) can switch passwords back on. Check it:

grep -r PasswordAuthentication /etc/ssh/sshd_config.d/

Change any yes there to no, then reload SSH and confirm the config is valid:

sshd -t && systemctl reload ssh

5. Confirm from a second window

Open a new terminal and log in again before closing the first. If something is wrong, the open session lets you fix it.

Don't lose the key

The private key is now your only way in. Back it up somewhere safe, and add a second key from another device so one lost laptop doesn't lock you out.

Deploy a server and lock it down with keys from day one.

Ready to deploy?

Fund a balance in crypto and get a server in ~60 seconds.

Get started →