LinuxCommandLibrary

keychain

manages SSH and GPG agent processes

TLDR

Start SSH agent

$ eval $(keychain --eval [id_rsa])
copy
Add multiple keys
$ eval $(keychain --eval [id_rsa] [id_ed25519])
copy
Include GPG keys
$ eval $(keychain --eval --agents ssh,gpg [id_rsa] [GPGKEY])
copy
Clear cached keys
$ keychain --clear
copy
Quiet mode
$ eval $(keychain -q --eval [id_rsa])
copy
Show status
$ keychain -l
copy

SYNOPSIS

keychain [options] [keys...]

DESCRIPTION

keychain is a front-end to ssh-agent and gpg-agent that manages long-running agent processes across login sessions. Rather than starting a new agent each time a shell is opened, keychain checks for an existing agent, reuses it if found, and only starts a new one when necessary, storing the agent's environment variables in files under `~/.keychain` so any shell can inherit them.
This approach means you only need to enter your passphrase once after a reboot, and all subsequent terminal sessions, cron jobs, and scripts can use the cached keys without further prompting. The tool supports managing both SSH and GPG keys simultaneously via the `--agents` flag and outputs shell-evaluable commands that set the appropriate `SSHAUTHSOCK` and `GPGAGENTINFO` environment variables.

PARAMETERS

KEYS

SSH or GPG keys to manage.
--eval
Output shell eval commands.
--agents LIST
Agent types (ssh, gpg).
--clear
Clear cached keys.
-q, --quiet
Suppress output.
-l, --list
List cached keys.
--help
Display help information.

CAVEATS

Shell integration required. Profile/rc file setup. Funtoo project.

HISTORY

keychain was created by Daniel Robbins (Funtoo) to simplify SSH agent management across sessions.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community