SSH-AGENT(1)
๐ ssh-agent(1) โ OpenSSH authentication agent โจ
okay so bestie, welcome to the General Commands Manual entry for ssh-agent and honestly? she's iconic. she's the little program that holds your private keys so you don't have to type your passphrase forty times a day. main character energy fr fr ๐
๐ธ SYNOPSIS ๐ธ
ssh-agent [-c | -s] [-DdTU] [-a bind_address] [-E fingerprint_hash]
[-O option] [-P allowed_providers] [-t life]
ssh-agent [-TU] [-a bind_address] [-E fingerprint_hash] [-O option]
[-P allowed_providers] [-t life] command [arg ...]
ssh-agent [-c | -s] -k
ssh-agent -u
๐ DESCRIPTION ๐
So ssh-agent is a program to hold private keys used for public key authentication. That's the whole vibe. ๐ซถ
Through use of environment variables the agent can be located and automatically used for authentication when logging in to other machines using ssh(1).
The options are as follows (brace yourself, she has range):
-abind_address โ Bind the agent to the Unix-domain socket bind_address. The default is to create a socket at a random path matching$HOME/.ssh/agent/s.*.-cโ Generate C-shell commands on standard output. This is the default ifSHELLlooks like it's a csh style of shell.-Dโ Foreground mode. When this option is specified,ssh-agentwill not fork.-dโ Debug mode. When this option is specified,ssh-agentwill not fork and will write debug information to standard error.-Efingerprint_hash โ Specifies the hash algorithm used when displaying key fingerprints. Valid options are: โmd5โ and โsha256โ. The default is โsha256โ. she's a modern girlie ๐-kโ Kill the current agent (given by theSSH_AGENT_PIDenvironment variable). rest in peace queen ๐-Ooption โ Specify an option when startingssh-agent. The supported options are:allow-remote-pkcs11,no-restrict-websafeandwebsafe-allow.
The allow-remote-pkcs11 option allows clients of a forwarded ssh-agent to load PKCS#11 or FIDO provider libraries. By default only local clients may perform this operation. Note that signalling that an ssh-agent client is remote is performed by ssh(1), and use of other tools to forward access to the agent socket may circumvent this restriction. (so like, the restriction is vibes-based if you use other tools, lowkey ๐)
The no-restrict-websafe option instructs ssh-agent to permit signatures using FIDO keys that might be web authentication requests. By default, ssh-agent refuses signature requests for FIDO keys where the key application string does not start with โssh:โ and when the data to be signed does not appear to be an ssh(1) user authentication request or an ssh-keygen(1) signature. The default behaviour prevents forwarded access to a FIDO key from also implicitly forwarding the ability to authenticate to websites. no cap, that's a good default ๐
Alternately the websafe-allow option allows specifying a pattern-list of key application strings to replace the default application allow-list, for example: โwebsafe-allow=ssh:*,example.org,*.example.comโ
See PATTERNS in ssh_config(5) for a description of pattern-list syntax.
-Pallowed_providers โ Specify a pattern-list of acceptable paths for PKCS#11 provider and FIDO authenticator middleware shared libraries that may be used with the-Sor-soptions tossh-add(1). Libraries that do not match the pattern list will be refused. The default list is โusr/lib*/*,/usr/local/lib*/*โ.
See PATTERNS in ssh_config(5) for a description of pattern-list syntax.
-sโ Generate Bourne shell commands on standard output. This is the default ifSHELLdoes not look like it's a csh style of shell.-Tโ Bind the agent socket in a randomised subdirectory of the form$TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>, instead of the default behaviour of using a randomised name matching$HOME/.ssh/agent/s.*. chaotic but organised, we stan โจ-tlife โ Set a default value for the maximum lifetime of identities added to the agent. The lifetime may be specified in seconds or in a time format specified insshd_config(5). A lifetime specified for an identity withssh-add(1)overrides this value. Without this option the default maximum lifetime is forever. (forever!! romantic ๐ฅน)-Uโ Instructsssh-agentnot to clean up stale agent sockets under$HOME/.ssh/agent/.-uโ Instructsssh-agentto only clean up stale agent sockets under$HOME/.ssh/agent/and then exit immediately. If this option is given twice,ssh-agentwill delete stale agent sockets regardless of the host name that created them. double it and give it to the next person ๐command[arg ...] โ If a command (and optional arguments) is given, this is executed as a subprocess of the agent. The agent exits automatically when the command given on the command line terminates.
๐ฆ There are three main ways to get an agent set up ๐ฆ
Method one โ the X session girlie. The first is at the start of an X session, where all other windows or programs are started as children of the ssh-agent program. The agent starts a command under which its environment variables are exported, for example ssh-agent xterm &. When the command terminates, so does the agent. matched energies โจ
Method two โ the login session classic. The second method is used for a login session. When ssh-agent is started, it prints the shell commands required to set its environment variables, which in turn can be evaluated in the calling shell, for example eval \ssh-agent -s``.
In both of these cases, ssh(1) looks at these environment variables and uses them to establish a connection to the agent.
Method three โ socket activation, the fancy one. The third way to run ssh-agent is via socket activation from a supervising process, such as systemd. In this mode, the supervising process creates the listening socket and is responsible for starting ssh-agent as needed, and also for communicating the location of the socket listener to other programs in the user's session. Socket activation is used when ssh-agent is started with either of the -d or -D flags, no socket listening address specified by the -a flag, and both the LISTEN_FDS and LISTEN_PID environment variables correctly supplied by the supervising process. iykyk ๐
The agent initially does not have any private keys. Keys are added using ssh-add(1) or by ssh(1) when AddKeysToAgent is set in ssh_config(5). Multiple identities may be stored in ssh-agent concurrently and ssh(1) will automatically use them if present. ssh-add(1) is also used to remove keys from ssh-agent and to query the keys that are held in one.
Connections to ssh-agent may be forwarded from further remote hosts using the -A option to ssh(1) (but see the caveats documented therein), avoiding the need for authentication data to be stored on other machines. Authentication passphrases and private keys never go over the network: the connection to the agent is forwarded over SSH remote connections and the result is returned to the requester, allowing the user access to their identities anywhere in the network in a secure fashion. literally the whole point and she ate ๐ฅ
โ ๏ธ heads up bestie:ssh-agentwill delete all keys it has loaded upon receivingSIGUSR1. no undos, no takebacks, gone girl ๐
๐ ENVIRONMENT ๐
SSH_AGENT_PIDโ Whenssh-agentstarts, it stores the name of the agent's process ID (PID) in this variable.SSH_AUTH_SOCKโ Whenssh-agentstarts, it creates a Unix-domain socket and stores its pathname in this variable. It is accessible only to the current user, but is easily abused by root or another instance of the same user.
๐จ okay so real talk: SSH_AUTH_SOCK is only protected from other users, not from root or from another process running as you. keep that in mind, bestie.
๐ FILES ๐
$HOME/.ssh/agent/s.*โ Unix-domain sockets used to contain the connection to the authentication agent. These sockets should only be readable by the owner. The sockets should get automatically removed when the agent exits.
โญ SEE ALSO โญ
ssh(1), ssh-add(1), ssh-keygen(1), ssh_config(5), sshd(8)
๐ AUTHORS ๐
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0. legends, every single one ๐ซถ
and that's the whole page bestie!! this edition is from Debian, dated October 4, 2025 โ go forth and eval $(ssh-agent -s) responsibly ๐โจ๐
๐ฆ where this page comes from
- alpine 3.23: openssh-doc 10.2_p1-r0 ยท SSH-OpenSSH
- fedora 44: openssh-clients 10.2p1-14.fc44
- fedora 44: openssh-clients 10.2p1-16.fc44 ยท BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- fedora 44: openssh-clients 10.2p1-7.fc44 ยท BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
- Copyright (c) 1999,2000 Markus Friedl. All rights reserved
- Copyright (c) 1999 Aaron Campbell. All rights reserved
- Copyright (c) 1999 Theo de Raadt. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms