# ssh-agent

> A helper that holds your keys open. You type the passphrase just once.

**Field:** Infrastructure  
**Category:** SSH & Remote Access  
**Also known as:** SSH Agent, ssh-add, SSH Key Agent

## Think of it like

Think of it like a friend who holds your keys while you are out. You ask, and they open the door for you.

## Definition

ssh-agent is a small program that holds your unlocked private keys in memory. You add a key with ssh-add and type its passphrase once. After that, ssh asks the agent to sign for you. You do not type the passphrase again until the agent stops. The keys never leave your own computer.

## Example

Lucy logs in to servers twenty times a day. She adds her key to ssh-agent each morning and types the passphrase just once.

## Example code

```console
$ ssh-add ~/.ssh/id_ed25519
Enter passphrase for /home/lucy/.ssh/id_ed25519:
Identity added: /home/lucy/.ssh/id_ed25519 (lucy@laptop)
```

Type the passphrase once. The agent keeps the key open for the rest of the session.

## Why it matters

It makes a locked key as easy to use as an open one. So there is no need to skip the passphrase.

## Common mistake

Turning on agent forwarding to servers you do not trust. Anyone with root there can use your agent while you are logged in.

## Three principles

- **Holds keys open.** In memory, on your computer.
- **Passphrase once.** Then it signs for you.
- **Careful forwarding.** Only to servers you trust.

## Related terms

- [SSH Key Passphrase](https://learn.benibix.com/term/infrastructure/ssh-key-passphrase)
- [SSH Key Pair](https://learn.benibix.com/term/infrastructure/ssh-key-pair)
- [SSH Public Key Authentication](https://learn.benibix.com/term/infrastructure/public-key-authentication)
- [Jump Host](https://learn.benibix.com/term/infrastructure/jump-host)

## 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-agent
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.
