Servers and hosting

SSH key

A key pair used to log in to a server instead of a password. The private key stays on your machine; the public key goes on the server.


SSH keys replace password logins. You generate a pair once, ssh-keygen -t ed25519; the public half is placed in ~/.ssh/authorized_keys on the server, the private half never leaves your computer. When you connect, the server challenges you to prove you hold the private key, and no password crosses the network.

Keys cannot be guessed by the bots that hammer every server's port 22 with password lists, which is why a server with keys only and PasswordAuthentication no can ignore that traffic. Protect the private key with a passphrase, and keep a second key or the provider's console as a way back in if you lose it.

Hosting control panels usually let you store public keys and apply them when a server is installed or rebuilt, so a fresh server is reachable with your key from the first minute and never has a root password at all.

First login on your VPS