ssh-add
Add, inspect and remove identities in an existing agent.
Before you run
An agent must be reachable via SSH_AUTH_SOCK. ssh-add -l reporting no identities is different from being unable to connect to the agent. -t sets the loaded identity’s lifetime; it does not delete or expire the key file. Removing an identity from the agent does not remove server authorization or a saved keychain item.
Examples
Load a private key for one hour; enter its passphrase if requested.
ssh-add -t 1h ~/.ssh/id_ed25519List fingerprints of identities currently loaded in the agent.
ssh-add -lRemove this identity from the agent without deleting its file.
ssh-add -d ~/.ssh/id_ed25519Options and examples
identity_fileCommonAdd a private key to the agent, prompting for its passphrase when needed.
ssh-add ~/.ssh/id_ed25519-l / -LCommonList fingerprints or public keys currently held by the agent.
ssh-add -l-t lifeCommonLimit how long the identity stays in the agent; this does not expire or revoke the key itself.
ssh-add -t 1h ~/.ssh/id_ed25519-d identity_fileCommonRemove one identity from the agent; this does not revoke it on the server.
ssh-add -d ~/.ssh/id_ed25519-DRemove all identities from the current agent, without deleting key files.
ssh-add -D-cRequire confirmation before an added identity is used; an appropriate confirmation program is required.
ssh-add -c ~/.ssh/id_ed25519-x / -XLock or unlock the agent interactively.
ssh-add -x-T public_keyTest whether the agent can use the corresponding private key.
ssh-add -T ~/.ssh/id_ed25519.pubAuthoritative references
Reviewed October 27, 2026