# SSH Key Passphrase

> A password that locks your private key file. A stolen copy is then no use.

**Field:** Infrastructure  
**Category:** SSH & Remote Access  
**Also known as:** Key Passphrase, Passphrase (SSH), Encrypted Private Key

## Think of it like

Think of it like a lock on the box that holds your house key. A thief gets the box, not the key.

## Definition

A key passphrase is a password that locks your private key file. ssh-keygen asks for one when it makes the key. Without it, anyone who copies the file can use your key. With it, the file is useless until the passphrase is typed. It never goes to the server, only to your own key file.

## Example

Emma's laptop is stolen. Her private key had a passphrase, so the thief cannot use it to reach her servers.

## Example code

```console
$ ssh-keygen -t ed25519
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
```

ssh-keygen asks twice. Leaving it empty means the key file is not locked.

## Why it matters

A private key is the key to every server it opens. A passphrase protects it if the laptop is lost.

## Common mistake

Leaving it empty because typing it is a bother. ssh-agent fixes the typing, so you need not skip the lock.

## Three principles

- **Locks the file.** Not the server, the key.
- **Stays local.** Never sent over the network.
- **Pair it with an agent.** Type it once a day.

## Related terms

- [SSH Key Pair](https://learn.benibix.com/term/infrastructure/ssh-key-pair)
- [ssh-agent](https://learn.benibix.com/term/infrastructure/ssh-agent)
- [ssh-keygen](https://learn.benibix.com/term/infrastructure/ssh-keygen)

## Told apart from

- [SSH Key Passphrase vs SSH Password Login](https://learn.benibix.com/compare/ssh-key-passphrase-vs-ssh-password-authentication): People think a key passphrase is the same as a password login, and it is not. A password login sends a password to the server, and a bot can guess it there. A passphrase never leaves your laptop. It only unlocks your private key file, so a stolen copy of the file is no use.

## Taught in

- [SSH Agent and Passphrases](https://learn.benibix.com/learn/infrastructure-ssh/ssh-agent-and-passphrases): SSH, 4/9

![A key pair made by ssh-keygen. The private key stays on the laptop in ~/.ssh/id_ed25519, locked with a passphrase, and ssh-agent holds it open for the day. A copy of the public key sits on the server in ~/.ssh/authorized_keys. At login the server sends a challenge, the laptop signs it with the private key, and the server checks the signature with the public key.](https://learn.benibix.com/diagrams/inf3-ssh-keys.svg)

---

Source: https://learn.benibix.com/term/infrastructure/ssh-key-passphrase
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
