xref: /netbsd-src/crypto/external/bsd/openssh/dist/ssh-agent.1 (revision a629fefc36f2e87b36355a611e948fafe62680b4)
1.\" $NetBSD: ssh-agent.1,v 1.19 2023/10/25 20:19:57 christos Exp $
2.\" $OpenBSD: ssh-agent.1,v 1.79 2023/08/10 14:37:32 naddy Exp $
3.\"
4.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
5.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6.\"                    All rights reserved
7.\"
8.\" As far as I am concerned, the code I have written for this software
9.\" can be used freely for any purpose.  Any derived versions of this
10.\" software must be clearly marked as such, and if the derived work is
11.\" incompatible with the protocol description in the RFC file, it must be
12.\" called by a name other than "ssh" or "Secure Shell".
13.\"
14.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
15.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
16.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
17.\"
18.\" Redistribution and use in source and binary forms, with or without
19.\" modification, are permitted provided that the following conditions
20.\" are met:
21.\" 1. Redistributions of source code must retain the above copyright
22.\"    notice, this list of conditions and the following disclaimer.
23.\" 2. Redistributions in binary form must reproduce the above copyright
24.\"    notice, this list of conditions and the following disclaimer in the
25.\"    documentation and/or other materials provided with the distribution.
26.\"
27.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37.\"
38.Dd August 10 2023
39.Dt SSH-AGENT 1
40.Os
41.Sh NAME
42.Nm ssh-agent
43.Nd OpenSSH authentication agent
44.Sh SYNOPSIS
45.Nm ssh-agent
46.Op Fl c | s
47.Op Fl \&Dd
48.Op Fl a Ar bind_address
49.Op Fl E Ar fingerprint_hash
50.Op Fl O Ar option
51.Op Fl P Ar allowed_providers
52.Op Fl t Ar life
53.Nm ssh-agent
54.Op Fl a Ar bind_address
55.Op Fl E Ar fingerprint_hash
56.Op Fl O Ar option
57.Op Fl P Ar allowed_providers
58.Op Fl t Ar life
59.Ar command Op Ar arg ...
60.Nm ssh-agent
61.Op Fl c | s
62.Fl k
63.Sh DESCRIPTION
64.Nm
65is a program to hold private keys used for public key authentication.
66Through use of environment variables the agent can be located
67and automatically used for authentication when logging in to other
68machines using
69.Xr ssh 1 .
70.Pp
71The options are as follows:
72.Bl -tag -width Ds
73.It Fl a Ar bind_address
74Bind the agent to the
75.Ux Ns -domain
76socket
77.Ar bind_address .
78The default is
79.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt .
80.It Fl c
81Generate C-shell commands on
82.Dv stdout .
83This is the default if
84.Ev SHELL
85looks like it's a csh style of shell.
86.It Fl D
87Foreground mode.
88When this option is specified,
89.Nm
90will not fork.
91.It Fl d
92Debug mode.
93When this option is specified,
94.Nm
95will not fork and will write debug information to standard error.
96.It Fl E Ar fingerprint_hash
97Specifies the hash algorithm used when displaying key fingerprints.
98Valid options are:
99.Dq md5
100and
101.Dq sha256 .
102The default is
103.Dq sha256 .
104.It Fl k
105Kill the current agent (given by the
106.Ev SSH_AGENT_PID
107environment variable).
108.It Fl O Ar option
109Specify an option when starting
110.Nm .
111Currently two options are supported:
112.Cm allow-remote-pkcs11
113and
114.Cm no-restrict-websafe .
115.Pp
116The
117.Cm allow-remote-pkcs11
118option allows clients of a forwarded
119.Nm
120to load PKCS#11 or FIDO provider libraries.
121By default only local clients may perform this operation.
122Note that signalling that an
123.Nm
124client is remote is performed by
125.Xr ssh 1 ,
126and use of other tools to forward access to the agent socket may circumvent
127this restriction.
128.Pp
129The
130.Cm no-restrict-websafe
131option instructs
132.Nm
133to permit signatures using FIDO keys that might be web authentication
134requests.
135By default,
136.Nm
137refuses signature requests for FIDO keys where the key application string
138does not start with
139.Dq ssh:
140and when the data to be signed does not appear to be a
141.Xr ssh 1
142user authentication request or a
143.Xr ssh-keygen 1
144signature.
145The default behaviour prevents forwarded access to a FIDO key from also
146implicitly forwarding the ability to authenticate to websites.
147.It Fl P Ar allowed_providers
148Specify a pattern-list of acceptable paths for PKCS#11 provider and FIDO
149authenticator middleware shared libraries that may be used with the
150.Fl S
151or
152.Fl s
153options to
154.Xr ssh-add 1 .
155Libraries that do not match the pattern list will be refused.
156See PATTERNS in
157.Xr ssh_config 5
158for a description of pattern-list syntax.
159The default list is
160.Dq /usr/lib/*,/usr/local/lib/* .
161.It Fl s
162Generate Bourne shell commands on
163.Dv stdout .
164This is the default if
165.Ev SHELL
166does not look like it's a csh style of shell.
167.It Fl t Ar life
168Set a default value for the maximum lifetime of identities added to the agent.
169The lifetime may be specified in seconds or in a time format specified in
170.Xr sshd_config 5 .
171A lifetime specified for an identity with
172.Xr ssh-add 1
173overrides this value.
174Without this option the default maximum lifetime is forever.
175.It Ar command Op Ar arg ...
176If a command (and optional arguments) is given,
177this is executed as a subprocess of the agent.
178The agent exits automatically when the command given on the command
179line terminates.
180.El
181.Pp
182There are two main ways to get an agent set up.
183The first is at the start of an X session,
184where all other windows or programs are started as children of the
185.Nm
186program.
187The agent starts a command under which its environment
188variables are exported, for example
189.Cm ssh-agent xterm & .
190When the command terminates, so does the agent.
191.Pp
192The second method is used for a login session.
193When
194.Nm
195is started,
196it prints the shell commands required to set its environment variables,
197which in turn can be evaluated in the calling shell, for example
198.Cm eval `ssh-agent -s` .
199.Pp
200In both cases,
201.Xr ssh 1
202looks at these environment variables
203and uses them to establish a connection to the agent.
204.Pp
205The agent initially does not have any private keys.
206Keys are added using
207.Xr ssh-add 1
208or by
209.Xr ssh 1
210when
211.Cm AddKeysToAgent
212is set in
213.Xr ssh_config 5 .
214Multiple identities may be stored in
215.Nm
216concurrently and
217.Xr ssh 1
218will automatically use them if present.
219.Xr ssh-add 1
220is also used to remove keys from
221.Nm
222and to query the keys that are held in one.
223.Pp
224Connections to
225.Nm
226may be forwarded from further remote hosts using the
227.Fl A
228option to
229.Xr ssh 1
230(but see the caveats documented therein),
231avoiding the need for authentication data to be stored on other machines.
232Authentication passphrases and private keys never go over the network:
233the connection to the agent is forwarded over SSH remote connections
234and the result is returned to the requester,
235allowing the user access to their identities anywhere in the network
236in a secure fashion.
237.Sh ENVIRONMENT
238.Bl -tag -width "SSH_AGENT_PID"
239.It Ev SSH_AGENT_PID
240When
241.Nm
242starts, it stores the name of the agent's process ID (PID) in this variable.
243.It Ev SSH_AUTH_SOCK
244When
245.Nm
246starts, it creates a
247.Ux Ns -domain
248socket and stores its pathname in this variable.
249It is accessible only to the current user,
250but is easily abused by root or another instance of the same user.
251.El
252.Sh FILES
253.Bl -tag -width Ds
254.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>
255.Ux Ns -domain
256sockets used to contain the connection to the authentication agent.
257These sockets should only be readable by the owner.
258The sockets should get automatically removed when the agent exits.
259.El
260.Sh SEE ALSO
261.Xr ssh 1 ,
262.Xr ssh-add 1 ,
263.Xr ssh-keygen 1 ,
264.Xr ssh_config 5 ,
265.Xr sshd 8
266.Sh AUTHORS
267.An -nosplit
268OpenSSH is a derivative of the original and free ssh 1.2.12 release by
269.An Tatu Ylonen .
270.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt
271and
272.An Dug Song
273removed many bugs, re-added newer features and created OpenSSH.
274.An Markus Friedl
275contributed the support for SSH protocol versions 1.5 and 2.0.
276