No KYC · US and Europe, one price in six cities · Pay in BTC, USDT, USDC, ETH, SOL, LTC
Order a VPS

Guide · SSH · OpenSSH release notes read 3 November 2026

How do you set up SSH keys and lock down SSH on a Linux VPS?

Which key to create in 2026, where the public half goes, how to check you reached the right server, how sshd really reads its drop-in files, and how not to lock yourself out. Commands for Debian 13, Debian 12 and Ubuntu 24.04, with the AlmaLinux and Rocky Linux variants.

Last updated: · 7 min read

Quick answer

How do I use SSH keys to secure my VPS?

Create an ed25519 key on your own computer with ssh-keygen -t ed25519, protect it with a passphrase, and paste only the .pub half at checkout. On VPS With Crypto, a key given at checkout means password login stays off from the first boot. OpenSSH 10.6, released on 6 October 2026, still generates ed25519 by default; this guide was checked on 3 November 2026.

Which key type should you create in 2026?

Create an ed25519 key: it is the default of ssh-keygen, short enough to paste anywhere, and accepted by every current server. Three other cases:

  • A hardware key. ed25519-sk keeps the private key on a FIDO2 token such as a YubiKey; each login needs a touch. Both ends need OpenSSH 8.2 or newer, which every image in our list ships.
  • RSA. Still accepted when it is 3072 bits or longer. OpenSSH 8.8 turned off by default only the old ssh-rsa signature scheme based on SHA-1, not RSA keys themselves.
  • DSA. Gone. OpenSSH 10.0 removed it in April 2025, and the Debian 13 release notes say DSA keys no longer work at all.

Use one key per device and name it in the comment. Revoking a lost laptop is then one line to delete, not a key to replace everywhere.

On your own computer (Linux, macOS, or PowerShell on Windows 10 and 11)
ssh-keygen -t ed25519 -C "alice-laptop-2026"

# or with a FIDO2 hardware key
ssh-keygen -t ed25519-sk -C "alice-yubikey-2026"

# the public half: this is what you paste at checkout
cat ~/.ssh/id_ed25519.pub

# load it once per session so the passphrase is asked only once
ssh-add ~/.ssh/id_ed25519

Where does the public key go?

At checkout for the first one, then in ~/.ssh/authorized_keys on the server for every other device. You log in as root over SSH. Add a public key at checkout and password login stays disabled; skip it and the team sets a temporary root password, shown in your dashboard, that you change with passwd the first time you log in.

The private key never leaves your computer and is never asked for. To add a second device later, ssh-copy-id appends its public key over a login that already works. By hand, the rules are strict: the .ssh directory in mode 700, authorized_keys in mode 600, both owned by the user. sshd ignores a file that others can write.

A Host block in ~/.ssh/config saves typing and makes ssh offer only the right key. That matters once your agent holds many keys: sshd closes the connection after MaxAuthTries failed attempts, 6 by default.

Add a second device, then give the server a short name
# from the new device, while another key still works on the server
ssh-copy-id -i ~/.ssh/id_ed25519.pub [email protected]

# ~/.ssh/config
Host web1
    HostName 203.0.113.10
    User alice
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes

How do you check you reached the right server?

Compare the fingerprint your client stored with the one the server holds. On the first connection ssh shows the server's host key fingerprint and records it in ~/.ssh/known_hosts. Once logged in, print the server's own fingerprint and compare the two. They must match character for character.

A later warning that the host key changed has one innocent cause on a VPS: a reinstall, which creates new host keys. Reboot, reinstall and delete are requests you send from the dashboard, carried out by a person. A reinstall erases the disk. If you asked for a reinstall, remove the old entry with ssh-keygen -R. If you did not, stop and ask support before you type a password or forward anything.

Two fingerprints that must match
# on the server
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub

# on your computer: what known_hosts recorded
ssh-keygen -lF 203.0.113.10

# after a reinstall you asked for
ssh-keygen -R 203.0.113.10

How does sshd read drop-in files, and why does the name matter?

sshd keeps the first value it reads for most keywords, so the file read first wins. The sshd_config manual says so in one line. Debian and Ubuntu put Include /etc/ssh/sshd_config.d/*.conf at the top of /etc/ssh/sshd_config, and the matching files are read in alphabetical order. Two consequences:

  • A drop-in beats the main file, whatever the main file says further down.
  • Among drop-ins, 00-hardening.conf beats 50-cloud-init.conf. Cloud images often carry that second file, sometimes with PasswordAuthentication yes. A 99-hardening.conf would lose to it.

Trust sshd -T over your reading of the files: it prints the values the daemon will use. Then test from outside with password login forced; the server must answer Permission denied (publickey).

Keys only, root by key or not at all, named users
cat > /etc/ssh/sshd_config.d/00-hardening.conf <<'EOF'
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
AllowUsers alice
EOF

sshd -t && systemctl restart ssh      # AlmaLinux, Rocky: systemctl restart sshd
sshd -T | grep -Ei '^(passwordauthentication|kbdinteractiveauthentication|permitrootlogin|allowusers)'

# from your computer, in a second terminal: this must fail
ssh -o PubkeyAuthentication=no -o PreferredAuthentications=password [email protected]

What else cuts down what an attacker can try?

  • Fewer open ports. A firewall that allows 22 and the ports of your services only. Better still, reach SSH over a private tunnel and close it to the world: WireGuard on a VPS shows how.
  • A jump host instead of agent forwarding. ssh -J alice@bastion alice@db1 reaches an inner server without exposing your agent on the middle machine, which ForwardAgent yes does.
  • Post-quantum key exchange. OpenSSH 10.0 made mlkem768x25519-sha256 the default key agreement, and since 10.1 the client warns when a connection falls back to one without post-quantum protection. Debian 13 ships OpenSSH 10.0p1. If you see that warning, the old side needs an upgrade; there is nothing to configure.
  • fail2ban, if you want shorter logs. With keys only it adds little safety. Debian 12 and 13 log to the systemd journal, so the jail needs backend = systemd.
fail2ban reading the journal
apt install fail2ban python3-systemd
cat > /etc/fail2ban/jail.d/sshd.local <<'EOF'
[sshd]
enabled = true
backend = systemd
EOF
systemctl restart fail2ban
fail2ban-client status sshd

What happens if you lose your key?

Keep two keys on the server from the first day: your laptop's and a second one kept apart, such as a hardware token or an offline copy. Losing one then costs a line in authorized_keys, not a server. No dashboard action brings back a lost private key: it never left your computer.

Your customer account is a separate key with its own rule. You sign in with an account number alone; adding an email is up to you. Your account number is the only key to the account. With an email on file you can get it back; without one, a lost number cannot be recovered. Store the account number and your SSH keys in different places, so one lost bag does not take both.

Which plan do you need for this?

Any of them: SSH hardening costs no CPU and no RAM. The smallest, Byte (1 vCPU / 2 GB / 40 GB), also makes a good jump host in front of servers you run elsewhere, at $2.25 a month on a 12-month term or $3.21 month to month. Every VPS runs Linux, installed from our Debian, Ubuntu, AlmaLinux or Rocky Linux images; Windows is not sold.

What else do people ask about SSH keys on a VPS?

Can I add a key after ordering without one?

Yes. Log in with the temporary root password from your dashboard, change it with passwd, run ssh-copy-id from your computer, test the key in a second terminal, then turn password login off with the drop-in above.

Should my key have a passphrase?

Yes. It encrypts the private key file, so a copied laptop disk or backup does not hand over your servers. ssh-add keeps the unlocked key in memory for the session, so you type it once.

Is RSA still acceptable for SSH?

A 3072-bit or longer RSA key still works with current servers through the SHA-2 signature schemes. ed25519 is shorter, faster and the default of ssh-keygen, so new keys have no reason to be RSA.

Does VPS With Crypto ever see my private key?

No. Checkout asks for the public key only, the line that starts with ssh-ed25519. Never paste the file without .pub, here or anywhere.

Why does ssh warn that the host key changed?

The server presents a different key than the one in your known_hosts. After a reinstall that is expected; remove the old entry with ssh-keygen -R. Without a reinstall, stop and find out why before logging in.

Paste your key at checkout and skip passwords entirely

Every plan is root over SSH on Debian, Ubuntu, AlmaLinux or Rocky Linux, from $2.25 a month on a 12-month term, paid in crypto with no ID.

Sources (7)
  1. ssh-keygen(1) — OpenBSD / OpenSSH (read 2026-11-03)
  2. sshd_config(5) — OpenBSD / OpenSSH (read 2026-11-03)
  3. OpenSSH release notes (8.2, 8.8, 10.0, 10.1, 10.6) — OpenSSH (read 2026-11-03)
  4. Debian 13 release notes: what's new (OpenSSH 10.0p1) — Debian (read 2026-11-03)
  5. Debian 13 release notes: issues to be aware of (DSA keys) — Debian (read 2026-11-03)
  6. Debian 12 release notes: changes to system logging — Debian (read 2026-11-03)
  7. OpenSSH server (drop-ins in sshd_config.d) — Canonical (read 2026-11-03)

From $2.25/month on 12 months · no KYC

Order a VPS