xref: /freebsd/crypto/openssh/ssh-agent.1 (revision edf8578117e8844e02c0121147f45e4609b30680)
1*edf85781SEd Maste.\" $OpenBSD: ssh-agent.1,v 1.79 2023/08/10 14:37:32 naddy Exp $
2511b41d2SMark Murray.\"
3511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5511b41d2SMark Murray.\"                    All rights reserved
6511b41d2SMark Murray.\"
7b66f2d16SKris Kennaway.\" As far as I am concerned, the code I have written for this software
8b66f2d16SKris Kennaway.\" can be used freely for any purpose.  Any derived versions of this
9b66f2d16SKris Kennaway.\" software must be clearly marked as such, and if the derived work is
10b66f2d16SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be
11b66f2d16SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell".
12b66f2d16SKris Kennaway.\"
13b66f2d16SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
14b66f2d16SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
15b66f2d16SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
16b66f2d16SKris Kennaway.\"
17b66f2d16SKris Kennaway.\" Redistribution and use in source and binary forms, with or without
18b66f2d16SKris Kennaway.\" modification, are permitted provided that the following conditions
19b66f2d16SKris Kennaway.\" are met:
20b66f2d16SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright
21b66f2d16SKris Kennaway.\"    notice, this list of conditions and the following disclaimer.
22b66f2d16SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright
23b66f2d16SKris Kennaway.\"    notice, this list of conditions and the following disclaimer in the
24b66f2d16SKris Kennaway.\"    documentation and/or other materials provided with the distribution.
25b66f2d16SKris Kennaway.\"
26b66f2d16SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27b66f2d16SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28b66f2d16SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29b66f2d16SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30b66f2d16SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31b66f2d16SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32b66f2d16SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33b66f2d16SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34b66f2d16SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35b66f2d16SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36511b41d2SMark Murray.\"
37*edf85781SEd Maste.Dd $Mdocdate: August 10 2023 $
38511b41d2SMark Murray.Dt SSH-AGENT 1
39511b41d2SMark Murray.Os
40511b41d2SMark Murray.Sh NAME
41511b41d2SMark Murray.Nm ssh-agent
4219261079SEd Maste.Nd OpenSSH authentication agent
43511b41d2SMark Murray.Sh SYNOPSIS
44511b41d2SMark Murray.Nm ssh-agent
454a421b63SDag-Erling Smørgrav.Op Fl c | s
46acc1a9efSDag-Erling Smørgrav.Op Fl \&Ddx
47d4af9e69SDag-Erling Smørgrav.Op Fl a Ar bind_address
48bc5531deSDag-Erling Smørgrav.Op Fl E Ar fingerprint_hash
49f374ba41SEd Maste.Op Fl O Ar option
5019261079SEd Maste.Op Fl P Ar allowed_providers
51d4af9e69SDag-Erling Smørgrav.Op Fl t Ar life
5219261079SEd Maste.Nm ssh-agent
5319261079SEd Maste.Op Fl a Ar bind_address
5419261079SEd Maste.Op Fl E Ar fingerprint_hash
55f374ba41SEd Maste.Op Fl O Ar option
5619261079SEd Maste.Op Fl P Ar allowed_providers
5719261079SEd Maste.Op Fl t Ar life
5819261079SEd Maste.Ar command Op Ar arg ...
591e8db6e2SBrian Feldman.Nm ssh-agent
604a421b63SDag-Erling Smørgrav.Op Fl c | s
611e8db6e2SBrian Feldman.Fl k
62511b41d2SMark Murray.Sh DESCRIPTION
63511b41d2SMark Murray.Nm
6419261079SEd Masteis a program to hold private keys used for public key authentication.
65a8f6863aSKris KennawayThrough use of environment variables the agent can be located
66b66f2d16SKris Kennawayand automatically used for authentication when logging in to other
67511b41d2SMark Murraymachines using
68511b41d2SMark Murray.Xr ssh 1 .
69511b41d2SMark Murray.Pp
70511b41d2SMark MurrayThe options are as follows:
71511b41d2SMark Murray.Bl -tag -width Ds
72545d5ecaSDag-Erling Smørgrav.It Fl a Ar bind_address
73b15c8340SDag-Erling SmørgravBind the agent to the
74b15c8340SDag-Erling Smørgrav.Ux Ns -domain
75b15c8340SDag-Erling Smørgravsocket
76545d5ecaSDag-Erling Smørgrav.Ar bind_address .
77545d5ecaSDag-Erling SmørgravThe default is
784a421b63SDag-Erling Smørgrav.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt .
79511b41d2SMark Murray.It Fl c
80511b41d2SMark MurrayGenerate C-shell commands on
81511b41d2SMark Murray.Dv stdout .
82511b41d2SMark MurrayThis is the default if
83511b41d2SMark Murray.Ev SHELL
84511b41d2SMark Murraylooks like it's a csh style of shell.
85557f75e5SDag-Erling Smørgrav.It Fl D
86557f75e5SDag-Erling SmørgravForeground mode.
8787c1498dSEd MasteWhen this option is specified,
88557f75e5SDag-Erling Smørgrav.Nm
89557f75e5SDag-Erling Smørgravwill not fork.
90d4af9e69SDag-Erling Smørgrav.It Fl d
91d4af9e69SDag-Erling SmørgravDebug mode.
9287c1498dSEd MasteWhen this option is specified,
93d4af9e69SDag-Erling Smørgrav.Nm
94557f75e5SDag-Erling Smørgravwill not fork and will write debug information to standard error.
95bc5531deSDag-Erling Smørgrav.It Fl E Ar fingerprint_hash
96bc5531deSDag-Erling SmørgravSpecifies the hash algorithm used when displaying key fingerprints.
97bc5531deSDag-Erling SmørgravValid options are:
98bc5531deSDag-Erling Smørgrav.Dq md5
99bc5531deSDag-Erling Smørgravand
100bc5531deSDag-Erling Smørgrav.Dq sha256 .
101bc5531deSDag-Erling SmørgravThe default is
102bc5531deSDag-Erling Smørgrav.Dq sha256 .
103d4af9e69SDag-Erling Smørgrav.It Fl k
104d4af9e69SDag-Erling SmørgravKill the current agent (given by the
105d4af9e69SDag-Erling Smørgrav.Ev SSH_AGENT_PID
106d4af9e69SDag-Erling Smørgravenvironment variable).
107f374ba41SEd Maste.It Fl O Ar option
108f374ba41SEd MasteSpecify an option when starting
109f374ba41SEd Maste.Nm .
11066fd12cfSEd MasteCurrently two options are supported:
11166fd12cfSEd Maste.Cm allow-remote-pkcs11
11266fd12cfSEd Masteand
113f374ba41SEd Maste.Cm no-restrict-websafe .
11466fd12cfSEd Maste.Pp
11566fd12cfSEd MasteThe
11666fd12cfSEd Maste.Cm allow-remote-pkcs11
11766fd12cfSEd Masteoption allows clients of a forwarded
11866fd12cfSEd Maste.Nm
11966fd12cfSEd Masteto load PKCS#11 or FIDO provider libraries.
12066fd12cfSEd MasteBy default only local clients may perform this operation.
121535af610SEd MasteNote that signalling that an
12266fd12cfSEd Maste.Nm
123535af610SEd Masteclient is remote is performed by
12466fd12cfSEd Maste.Xr ssh 1 ,
125*edf85781SEd Masteand use of other tools to forward access to the agent socket may circumvent
12666fd12cfSEd Mastethis restriction.
12766fd12cfSEd Maste.Pp
12866fd12cfSEd MasteThe
129535af610SEd Maste.Cm no-restrict-websafe
130535af610SEd Masteoption instructs
131f374ba41SEd Maste.Nm
132f374ba41SEd Masteto permit signatures using FIDO keys that might be web authentication
133f374ba41SEd Masterequests.
134f374ba41SEd MasteBy default,
135f374ba41SEd Maste.Nm
136f374ba41SEd Masterefuses signature requests for FIDO keys where the key application string
137f374ba41SEd Mastedoes not start with
138f374ba41SEd Maste.Dq ssh:
139f374ba41SEd Masteand when the data to be signed does not appear to be a
140f374ba41SEd Maste.Xr ssh 1
141f374ba41SEd Masteuser authentication request or a
142f374ba41SEd Maste.Xr ssh-keygen 1
143f374ba41SEd Mastesignature.
144f374ba41SEd MasteThe default behaviour prevents forwarded access to a FIDO key from also
145f374ba41SEd Masteimplicitly forwarding the ability to authenticate to websites.
14619261079SEd Maste.It Fl P Ar allowed_providers
14719261079SEd MasteSpecify a pattern-list of acceptable paths for PKCS#11 provider and FIDO
14819261079SEd Masteauthenticator middleware shared libraries that may be used with the
14919261079SEd Maste.Fl S
15019261079SEd Masteor
151ca86bcf2SDag-Erling Smørgrav.Fl s
15219261079SEd Masteoptions to
153ca86bcf2SDag-Erling Smørgrav.Xr ssh-add 1 .
15419261079SEd MasteLibraries that do not match the pattern list will be refused.
155ca86bcf2SDag-Erling SmørgravSee PATTERNS in
156ca86bcf2SDag-Erling Smørgrav.Xr ssh_config 5
157ca86bcf2SDag-Erling Smørgravfor a description of pattern-list syntax.
15819261079SEd MasteThe default list is
159*edf85781SEd Maste.Dq usr/lib*/*,/usr/local/lib*/* .
160511b41d2SMark Murray.It Fl s
161511b41d2SMark MurrayGenerate Bourne shell commands on
162511b41d2SMark Murray.Dv stdout .
163511b41d2SMark MurrayThis is the default if
164511b41d2SMark Murray.Ev SHELL
165511b41d2SMark Murraydoes not look like it's a csh style of shell.
166d0c8c0bcSDag-Erling Smørgrav.It Fl t Ar life
167d0c8c0bcSDag-Erling SmørgravSet a default value for the maximum lifetime of identities added to the agent.
168d0c8c0bcSDag-Erling SmørgravThe lifetime may be specified in seconds or in a time format specified in
169021d409fSDag-Erling Smørgrav.Xr sshd_config 5 .
170d0c8c0bcSDag-Erling SmørgravA lifetime specified for an identity with
171d0c8c0bcSDag-Erling Smørgrav.Xr ssh-add 1
172d0c8c0bcSDag-Erling Smørgravoverrides this value.
173d0c8c0bcSDag-Erling SmørgravWithout this option the default maximum lifetime is forever.
174eb45bc68SEd Maste.It Fl x
175eb45bc68SEd MasteExit after the last client has disconnected.
17619261079SEd Maste.It Ar command Op Ar arg ...
17719261079SEd MasteIf a command (and optional arguments) is given,
17819261079SEd Mastethis is executed as a subprocess of the agent.
17919261079SEd MasteThe agent exits automatically when the command given on the command
18019261079SEd Masteline terminates.
181511b41d2SMark Murray.El
182511b41d2SMark Murray.Pp
18319261079SEd MasteThere are two main ways to get an agent set up.
18419261079SEd MasteThe first is at the start of an X session,
18519261079SEd Mastewhere all other windows or programs are started as children of the
18619261079SEd Maste.Nm
18719261079SEd Masteprogram.
18819261079SEd MasteThe agent starts a command under which its environment
18919261079SEd Mastevariables are exported, for example
190d74d50a8SDag-Erling Smørgrav.Cm ssh-agent xterm & .
19119261079SEd MasteWhen the command terminates, so does the agent.
192d74d50a8SDag-Erling Smørgrav.Pp
19319261079SEd MasteThe second method is used for a login session.
19419261079SEd MasteWhen
19519261079SEd Maste.Nm
19619261079SEd Masteis started,
19719261079SEd Masteit prints the shell commands required to set its environment variables,
19819261079SEd Mastewhich in turn can be evaluated in the calling shell, for example
19919261079SEd Maste.Cm eval `ssh-agent -s` .
20019261079SEd Maste.Pp
20119261079SEd MasteIn both cases,
202511b41d2SMark Murray.Xr ssh 1
20319261079SEd Mastelooks at these environment variables
20419261079SEd Masteand uses them to establish a connection to the agent.
205511b41d2SMark Murray.Pp
20619261079SEd MasteThe agent initially does not have any private keys.
20719261079SEd MasteKeys are added using
20819261079SEd Maste.Xr ssh-add 1
20919261079SEd Masteor by
21019261079SEd Maste.Xr ssh 1
21119261079SEd Mastewhen
21219261079SEd Maste.Cm AddKeysToAgent
21319261079SEd Masteis set in
21419261079SEd Maste.Xr ssh_config 5 .
21519261079SEd MasteMultiple identities may be stored in
21619261079SEd Maste.Nm
21719261079SEd Masteconcurrently and
21819261079SEd Maste.Xr ssh 1
21919261079SEd Mastewill automatically use them if present.
22019261079SEd Maste.Xr ssh-add 1
22119261079SEd Masteis also used to remove keys from
22219261079SEd Maste.Nm
22319261079SEd Masteand to query the keys that are held in one.
224ae1f160dSDag-Erling Smørgrav.Pp
22519261079SEd MasteConnections to
22619261079SEd Maste.Nm
22719261079SEd Mastemay be forwarded from further remote hosts using the
22819261079SEd Maste.Fl A
22919261079SEd Masteoption to
23019261079SEd Maste.Xr ssh 1
23119261079SEd Maste(but see the caveats documented therein),
23219261079SEd Masteavoiding the need for authentication data to be stored on other machines.
23319261079SEd MasteAuthentication passphrases and private keys never go over the network:
23419261079SEd Mastethe connection to the agent is forwarded over SSH remote connections
23519261079SEd Masteand the result is returned to the requester,
23619261079SEd Masteallowing the user access to their identities anywhere in the network
23719261079SEd Mastein a secure fashion.
23819261079SEd Maste.Sh ENVIRONMENT
23919261079SEd Maste.Bl -tag -width "SSH_AGENT_PID"
24019261079SEd Maste.It Ev SSH_AGENT_PID
24119261079SEd MasteWhen
24219261079SEd Maste.Nm
24319261079SEd Mastestarts, it stores the name of the agent's process ID (PID) in this variable.
24419261079SEd Maste.It Ev SSH_AUTH_SOCK
24519261079SEd MasteWhen
24619261079SEd Maste.Nm
24719261079SEd Mastestarts, it creates a
248b15c8340SDag-Erling Smørgrav.Ux Ns -domain
24919261079SEd Mastesocket and stores its pathname in this variable.
25019261079SEd MasteIt is accessible only to the current user,
25119261079SEd Mastebut is easily abused by root or another instance of the same user.
25219261079SEd Maste.El
253511b41d2SMark Murray.Sh FILES
254511b41d2SMark Murray.Bl -tag -width Ds
255ca86bcf2SDag-Erling Smørgrav.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>
256b15c8340SDag-Erling Smørgrav.Ux Ns -domain
257b15c8340SDag-Erling Smørgravsockets used to contain the connection to the authentication agent.
258a8f6863aSKris KennawayThese sockets should only be readable by the owner.
259a8f6863aSKris KennawayThe sockets should get automatically removed when the agent exits.
260b66f2d16SKris Kennaway.El
261d95e11bfSDag-Erling Smørgrav.Sh SEE ALSO
262d95e11bfSDag-Erling Smørgrav.Xr ssh 1 ,
263d95e11bfSDag-Erling Smørgrav.Xr ssh-add 1 ,
264d95e11bfSDag-Erling Smørgrav.Xr ssh-keygen 1 ,
26519261079SEd Maste.Xr ssh_config 5 ,
266d95e11bfSDag-Erling Smørgrav.Xr sshd 8
2671e8db6e2SBrian Feldman.Sh AUTHORS
268ca86bcf2SDag-Erling Smørgrav.An -nosplit
269ca86bcf2SDag-Erling SmørgravOpenSSH is a derivative of the original and free ssh 1.2.12 release by
270ca86bcf2SDag-Erling Smørgrav.An Tatu Ylonen .
271ca86bcf2SDag-Erling Smørgrav.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt
272ca86bcf2SDag-Erling Smørgravand
273ca86bcf2SDag-Erling Smørgrav.An Dug Song
274ca86bcf2SDag-Erling Smørgravremoved many bugs, re-added newer features and created OpenSSH.
275ca86bcf2SDag-Erling Smørgrav.An Markus Friedl
276ca86bcf2SDag-Erling Smørgravcontributed the support for SSH protocol versions 1.5 and 2.0.
277