This page explains how logging in to a server with SSH works, with no prior knowledge needed. The next pages build on it.
Two programs talk to each other
SSH (Secure Shell) gives you a terminal on another machine over an encrypted connection. Two programs take part:
- The SSH client,
ssh, runs on your laptop. - The SSH server, usually called
sshd, runs on the server and waits for connections. The trailing “d” stands for daemon, which just means a program that runs in the background.
When you type ssh ubuntu@web-01, the part before the @ is the Linux account you want to use on the server, and the part after it is the server.
Proving who you are with a key pair
The server has to be sure it’s really you. The common way is a key pair, two files that belong together:
- The private key stays on your laptop. It is your secret and never leaves.
- The public key can be shared with anyone.
When you connect, the server sends a random challenge. Your client answers it using the private key. That answer is a signature. The server checks the signature with your public key. It can tell the answer is genuine without ever seeing the private key.
sequenceDiagram participant You as ssh (your laptop) participant Server as sshd (server) You->>Server: I want to log in as ubuntu Server->>You: Sign this random challenge You->>Server: Signature, made with your private key Note over Server: Checks it with your public key Server-->>You: Welcome
Think of it like a wax seal. Only you own the stamp, but everyone who has seen your seal can recognize it.
The classic setup: authorized_keys
So how does the server know which public keys to accept? Traditionally, every Linux account has a file called ~/.ssh/authorized_keys. It lists the public keys that may log in to that account. To give someone access, you paste their public key into that file.
That’s simple on one server. With many servers and many people, it gets hard:
- Every change touches every server. A new colleague means editing files on each server they need.
- Keys never expire. A key added years ago still works today.
- Nobody remembers who is who. A key is a long string of letters. It doesn’t say who owns it or why it’s there.
- Leavers linger. Removing someone means finding their key on every server. Miss one and they still have access.
These problems are exactly what certificates fix. The next page shows how.
Servers prove themselves too
Trust goes both ways. The first time you connect to a server, ssh usually asks something like this:
The authenticity of host 'web-01' can't be established.
Are you sure you want to continue connecting (yes/no)?
Your client has no way to know whether this is the real web-01 or an impostor. Most people type yes without checking. This is called trust on first use, or TOFU. After that, the client remembers the server’s key in ~/.ssh/known_hosts and warns you if it ever changes.
Nokku removes this prompt with host certificates, also covered on the next page.