Skip to content
BENIBIX Learn

SSH Public Key Authentication

Infrastructure🔑 SSH & Remote AccessSSH Key Authentication

Also known as Public Key Authentication, Key-Based Login, Passwordless SSH

You log in by proving you hold a private key. No password is sent.

Think of it like

Think of it like a secret handshake. The guard knows your half, and only you can do the rest.

Example

Emma turns on key login for her server and turns password login off. Bots guessing passwords now get nowhere.

Why it matters

It cannot be guessed like a password. A stolen server log holds no secret to use again.

Definition

Public key authentication is logging in with a key pair, not a password. The server sends your computer a random challenge. Your computer signs it with the private key. The server checks the sign with your public key from authorized_keys. If it matches, you are in, and no secret ever crossed the network.

Example code

console
$ ssh -v emma@203.0.113.10
debug1: Offering public key: /home/emma/.ssh/id_ed25519 ED25519
debug1: Server accepts key: /home/emma/.ssh/id_ed25519 ED25519
With -v, SSH shows its work. It offers the key, and the server accepts it.
The server sends a challenge. The laptop signs it, and the public key checks the sign.

Common mistake

Turning password login off before testing the key. Test the key in a second window first.

Key takeaways

  1. 1
    A challenge. The server asks a fresh question.
  2. 2
    Signed reply. Only the private key can sign it.
  3. 3
    Nothing to steal. No secret goes over the line.

Learn it properly