1SSH-AGENT(1) BSD General Commands Manual SSH-AGENT(1)
2
4 ssh-agent — authentication agent
5
7 ssh-agent [-c | -s] [-Dd] [-a bind_address] [-E fingerprint_hash]
8 [-P pkcs11_whitelist] [-t life] [command [arg ...]]
9 ssh-agent [-c | -s] -k
10
12 ssh-agent is a program to hold private keys used for public key authenti‐
13 cation (RSA, DSA, ECDSA, Ed25519). ssh-agent is usually started in the
14 beginning of an X-session or a login session, and all other windows or
15 programs are started as clients to the ssh-agent program. Through use of
16 environment variables the agent can be located and automatically used for
17 authentication when logging in to other machines using ssh(1).
18
19 The agent initially does not have any private keys. Keys are added using
20 ssh(1) (see AddKeysToAgent in ssh_config(5) for details) or ssh-add(1).
21 Multiple identities may be stored in ssh-agent concurrently and ssh(1)
22 will automatically use them if present. ssh-add(1) is also used to
23 remove keys from ssh-agent and to query the keys that are held in one.
24
25 The options are as follows:
26
27 -a bind_address
28 Bind the agent to the UNIX-domain socket bind_address. The
29 default is $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>.
30
31 -c Generate C-shell commands on stdout. This is the default if
32 SHELL looks like it's a csh style of shell.
33
34 -D Foreground mode. When this option is specified ssh-agent will
35 not fork.
36
37 -d Debug mode. When this option is specified ssh-agent will not
38 fork and will write debug information to standard error.
39
40 -E fingerprint_hash
41 Specifies the hash algorithm used when displaying key finger‐
42 prints. Valid options are: “md5” and “sha256”. The default is
43 “sha256”.
44
45 -k Kill the current agent (given by the SSH_AGENT_PID environment
46 variable).
47
48 -P pkcs11_whitelist
49 Specify a pattern-list of acceptable paths for PKCS#11 shared
50 libraries that may be added using the -s option to ssh-add(1).
51 The default is to allow loading PKCS#11 libraries from
52 “/usr/lib/*,/usr/local/lib/*”. PKCS#11 libraries that do not
53 match the whitelist will be refused. See PATTERNS in
54 ssh_config(5) for a description of pattern-list syntax.
55
56 -s Generate Bourne shell commands on stdout. This is the default if
57 SHELL does not look like it's a csh style of shell.
58
59 -t life
60 Set a default value for the maximum lifetime of identities added
61 to the agent. The lifetime may be specified in seconds or in a
62 time format specified in sshd_config(5). A lifetime specified
63 for an identity with ssh-add(1) overrides this value. Without
64 this option the default maximum lifetime is forever.
65
66 If a command line is given, this is executed as a subprocess of the
67 agent. When the command dies, so does the agent.
68
69 The idea is that the agent is run in the user's local PC, laptop, or ter‐
70 minal. Authentication data need not be stored on any other machine, and
71 authentication passphrases never go over the network. However, the con‐
72 nection to the agent is forwarded over SSH remote logins, and the user
73 can thus use the privileges given by the identities anywhere in the net‐
74 work in a secure way.
75
76 There are two main ways to get an agent set up: The first is that the
77 agent starts a new subcommand into which some environment variables are
78 exported, eg ssh-agent xterm &. The second is that the agent prints the
79 needed shell commands (either sh(1) or csh(1) syntax can be generated)
80 which can be evaluated in the calling shell, eg eval `ssh-agent -s` for
81 Bourne-type shells such as sh(1) or ksh(1) and eval `ssh-agent -c` for
82 csh(1) and derivatives.
83
84 Later ssh(1) looks at these variables and uses them to establish a con‐
85 nection to the agent.
86
87 The agent will never send a private key over its request channel.
88 Instead, operations that require a private key will be performed by the
89 agent, and the result will be returned to the requester. This way, pri‐
90 vate keys are not exposed to clients using the agent.
91
92 A UNIX-domain socket is created and the name of this socket is stored in
93 the SSH_AUTH_SOCK environment variable. The socket is made accessible
94 only to the current user. This method is easily abused by root or
95 another instance of the same user.
96
97 The SSH_AGENT_PID environment variable holds the agent's process ID.
98
99 The agent exits automatically when the command given on the command line
100 terminates.
101
103 $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>
104 UNIX-domain sockets used to contain the connection to the authen‐
105 tication agent. These sockets should only be readable by the
106 owner. The sockets should get automatically removed when the
107 agent exits.
108
110 ssh(1), ssh-add(1), ssh-keygen(1), sshd(8)
111
113 OpenSSH is a derivative of the original and free ssh 1.2.12 release by
114 Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo
115 de Raadt and Dug Song removed many bugs, re-added newer features and cre‐
116 ated OpenSSH. Markus Friedl contributed the support for SSH protocol
117 versions 1.5 and 2.0.
118
119BSD June 20, 2019 BSD