1*87c1498dSEd Maste.\" $OpenBSD: ssh-agent.1,v 1.73 2022/03/31 17:27:27 naddy Exp $ 27aee6ffeSDag-Erling Smørgrav.\" $FreeBSD$ 3511b41d2SMark Murray.\" 4511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 5511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 6511b41d2SMark Murray.\" All rights reserved 7511b41d2SMark Murray.\" 8b66f2d16SKris Kennaway.\" As far as I am concerned, the code I have written for this software 9b66f2d16SKris Kennaway.\" can be used freely for any purpose. Any derived versions of this 10b66f2d16SKris Kennaway.\" software must be clearly marked as such, and if the derived work is 11b66f2d16SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be 12b66f2d16SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell". 13b66f2d16SKris Kennaway.\" 14b66f2d16SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 15b66f2d16SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 16b66f2d16SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 17b66f2d16SKris Kennaway.\" 18b66f2d16SKris Kennaway.\" Redistribution and use in source and binary forms, with or without 19b66f2d16SKris Kennaway.\" modification, are permitted provided that the following conditions 20b66f2d16SKris Kennaway.\" are met: 21b66f2d16SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright 22b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer. 23b66f2d16SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright 24b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer in the 25b66f2d16SKris Kennaway.\" documentation and/or other materials provided with the distribution. 26b66f2d16SKris Kennaway.\" 27b66f2d16SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 28b66f2d16SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29b66f2d16SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30b66f2d16SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 31b66f2d16SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 32b66f2d16SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33b66f2d16SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34b66f2d16SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35b66f2d16SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36b66f2d16SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37511b41d2SMark Murray.\" 38*87c1498dSEd Maste.Dd $Mdocdate: March 31 2022 $ 39511b41d2SMark Murray.Dt SSH-AGENT 1 40511b41d2SMark Murray.Os 41511b41d2SMark Murray.Sh NAME 42511b41d2SMark Murray.Nm ssh-agent 4319261079SEd Maste.Nd OpenSSH authentication agent 44511b41d2SMark Murray.Sh SYNOPSIS 45511b41d2SMark Murray.Nm ssh-agent 464a421b63SDag-Erling Smørgrav.Op Fl c | s 47acc1a9efSDag-Erling Smørgrav.Op Fl \&Ddx 48d4af9e69SDag-Erling Smørgrav.Op Fl a Ar bind_address 49bc5531deSDag-Erling Smørgrav.Op Fl E Ar fingerprint_hash 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 5519261079SEd Maste.Op Fl P Ar allowed_providers 5619261079SEd Maste.Op Fl t Ar life 5719261079SEd Maste.Ar command Op Ar arg ... 581e8db6e2SBrian Feldman.Nm ssh-agent 594a421b63SDag-Erling Smørgrav.Op Fl c | s 601e8db6e2SBrian Feldman.Fl k 61511b41d2SMark Murray.Sh DESCRIPTION 62511b41d2SMark Murray.Nm 6319261079SEd Masteis a program to hold private keys used for public key authentication. 64a8f6863aSKris KennawayThrough use of environment variables the agent can be located 65b66f2d16SKris Kennawayand automatically used for authentication when logging in to other 66511b41d2SMark Murraymachines using 67511b41d2SMark Murray.Xr ssh 1 . 68511b41d2SMark Murray.Pp 69511b41d2SMark MurrayThe options are as follows: 70511b41d2SMark Murray.Bl -tag -width Ds 71545d5ecaSDag-Erling Smørgrav.It Fl a Ar bind_address 72b15c8340SDag-Erling SmørgravBind the agent to the 73b15c8340SDag-Erling Smørgrav.Ux Ns -domain 74b15c8340SDag-Erling Smørgravsocket 75545d5ecaSDag-Erling Smørgrav.Ar bind_address . 76545d5ecaSDag-Erling SmørgravThe default is 774a421b63SDag-Erling Smørgrav.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . 78511b41d2SMark Murray.It Fl c 79511b41d2SMark MurrayGenerate C-shell commands on 80511b41d2SMark Murray.Dv stdout . 81511b41d2SMark MurrayThis is the default if 82511b41d2SMark Murray.Ev SHELL 83511b41d2SMark Murraylooks like it's a csh style of shell. 84557f75e5SDag-Erling Smørgrav.It Fl D 85557f75e5SDag-Erling SmørgravForeground mode. 86*87c1498dSEd MasteWhen this option is specified, 87557f75e5SDag-Erling Smørgrav.Nm 88557f75e5SDag-Erling Smørgravwill not fork. 89d4af9e69SDag-Erling Smørgrav.It Fl d 90d4af9e69SDag-Erling SmørgravDebug mode. 91*87c1498dSEd MasteWhen this option is specified, 92d4af9e69SDag-Erling Smørgrav.Nm 93557f75e5SDag-Erling Smørgravwill not fork and will write debug information to standard error. 94bc5531deSDag-Erling Smørgrav.It Fl E Ar fingerprint_hash 95bc5531deSDag-Erling SmørgravSpecifies the hash algorithm used when displaying key fingerprints. 96bc5531deSDag-Erling SmørgravValid options are: 97bc5531deSDag-Erling Smørgrav.Dq md5 98bc5531deSDag-Erling Smørgravand 99bc5531deSDag-Erling Smørgrav.Dq sha256 . 100bc5531deSDag-Erling SmørgravThe default is 101bc5531deSDag-Erling Smørgrav.Dq sha256 . 102d4af9e69SDag-Erling Smørgrav.It Fl k 103d4af9e69SDag-Erling SmørgravKill the current agent (given by the 104d4af9e69SDag-Erling Smørgrav.Ev SSH_AGENT_PID 105d4af9e69SDag-Erling Smørgravenvironment variable). 10619261079SEd Maste.It Fl P Ar allowed_providers 10719261079SEd MasteSpecify a pattern-list of acceptable paths for PKCS#11 provider and FIDO 10819261079SEd Masteauthenticator middleware shared libraries that may be used with the 10919261079SEd Maste.Fl S 11019261079SEd Masteor 111ca86bcf2SDag-Erling Smørgrav.Fl s 11219261079SEd Masteoptions to 113ca86bcf2SDag-Erling Smørgrav.Xr ssh-add 1 . 11419261079SEd MasteLibraries that do not match the pattern list will be refused. 115ca86bcf2SDag-Erling SmørgravSee PATTERNS in 116ca86bcf2SDag-Erling Smørgrav.Xr ssh_config 5 117ca86bcf2SDag-Erling Smørgravfor a description of pattern-list syntax. 11819261079SEd MasteThe default list is 11919261079SEd Maste.Dq /usr/lib/*,/usr/local/lib/* . 120511b41d2SMark Murray.It Fl s 121511b41d2SMark MurrayGenerate Bourne shell commands on 122511b41d2SMark Murray.Dv stdout . 123511b41d2SMark MurrayThis is the default if 124511b41d2SMark Murray.Ev SHELL 125511b41d2SMark Murraydoes not look like it's a csh style of shell. 126d0c8c0bcSDag-Erling Smørgrav.It Fl t Ar life 127d0c8c0bcSDag-Erling SmørgravSet a default value for the maximum lifetime of identities added to the agent. 128d0c8c0bcSDag-Erling SmørgravThe lifetime may be specified in seconds or in a time format specified in 129021d409fSDag-Erling Smørgrav.Xr sshd_config 5 . 130d0c8c0bcSDag-Erling SmørgravA lifetime specified for an identity with 131d0c8c0bcSDag-Erling Smørgrav.Xr ssh-add 1 132d0c8c0bcSDag-Erling Smørgravoverrides this value. 133d0c8c0bcSDag-Erling SmørgravWithout this option the default maximum lifetime is forever. 13419261079SEd Maste.It Ar command Op Ar arg ... 13519261079SEd MasteIf a command (and optional arguments) is given, 13619261079SEd Mastethis is executed as a subprocess of the agent. 13719261079SEd MasteThe agent exits automatically when the command given on the command 13819261079SEd Masteline terminates. 139fceeafceSDag-Erling Smørgrav.It Fl x 140fceeafceSDag-Erling SmørgravExit after the last client has disconnected. 141511b41d2SMark Murray.El 142511b41d2SMark Murray.Pp 14319261079SEd MasteThere are two main ways to get an agent set up. 14419261079SEd MasteThe first is at the start of an X session, 14519261079SEd Mastewhere all other windows or programs are started as children of the 14619261079SEd Maste.Nm 14719261079SEd Masteprogram. 14819261079SEd MasteThe agent starts a command under which its environment 14919261079SEd Mastevariables are exported, for example 150d74d50a8SDag-Erling Smørgrav.Cm ssh-agent xterm & . 15119261079SEd MasteWhen the command terminates, so does the agent. 152d74d50a8SDag-Erling Smørgrav.Pp 15319261079SEd MasteThe second method is used for a login session. 15419261079SEd MasteWhen 15519261079SEd Maste.Nm 15619261079SEd Masteis started, 15719261079SEd Masteit prints the shell commands required to set its environment variables, 15819261079SEd Mastewhich in turn can be evaluated in the calling shell, for example 15919261079SEd Maste.Cm eval `ssh-agent -s` . 16019261079SEd Maste.Pp 16119261079SEd MasteIn both cases, 162511b41d2SMark Murray.Xr ssh 1 16319261079SEd Mastelooks at these environment variables 16419261079SEd Masteand uses them to establish a connection to the agent. 165511b41d2SMark Murray.Pp 16619261079SEd MasteThe agent initially does not have any private keys. 16719261079SEd MasteKeys are added using 16819261079SEd Maste.Xr ssh-add 1 16919261079SEd Masteor by 17019261079SEd Maste.Xr ssh 1 17119261079SEd Mastewhen 17219261079SEd Maste.Cm AddKeysToAgent 17319261079SEd Masteis set in 17419261079SEd Maste.Xr ssh_config 5 . 17519261079SEd MasteMultiple identities may be stored in 17619261079SEd Maste.Nm 17719261079SEd Masteconcurrently and 17819261079SEd Maste.Xr ssh 1 17919261079SEd Mastewill automatically use them if present. 18019261079SEd Maste.Xr ssh-add 1 18119261079SEd Masteis also used to remove keys from 18219261079SEd Maste.Nm 18319261079SEd Masteand to query the keys that are held in one. 184ae1f160dSDag-Erling Smørgrav.Pp 18519261079SEd MasteConnections to 18619261079SEd Maste.Nm 18719261079SEd Mastemay be forwarded from further remote hosts using the 18819261079SEd Maste.Fl A 18919261079SEd Masteoption to 19019261079SEd Maste.Xr ssh 1 19119261079SEd Maste(but see the caveats documented therein), 19219261079SEd Masteavoiding the need for authentication data to be stored on other machines. 19319261079SEd MasteAuthentication passphrases and private keys never go over the network: 19419261079SEd Mastethe connection to the agent is forwarded over SSH remote connections 19519261079SEd Masteand the result is returned to the requester, 19619261079SEd Masteallowing the user access to their identities anywhere in the network 19719261079SEd Mastein a secure fashion. 19819261079SEd Maste.Sh ENVIRONMENT 19919261079SEd Maste.Bl -tag -width "SSH_AGENT_PID" 20019261079SEd Maste.It Ev SSH_AGENT_PID 20119261079SEd MasteWhen 20219261079SEd Maste.Nm 20319261079SEd Mastestarts, it stores the name of the agent's process ID (PID) in this variable. 20419261079SEd Maste.It Ev SSH_AUTH_SOCK 20519261079SEd MasteWhen 20619261079SEd Maste.Nm 20719261079SEd Mastestarts, it creates a 208b15c8340SDag-Erling Smørgrav.Ux Ns -domain 20919261079SEd Mastesocket and stores its pathname in this variable. 21019261079SEd MasteIt is accessible only to the current user, 21119261079SEd Mastebut is easily abused by root or another instance of the same user. 21219261079SEd Maste.El 213511b41d2SMark Murray.Sh FILES 214511b41d2SMark Murray.Bl -tag -width Ds 215ca86bcf2SDag-Erling Smørgrav.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid> 216b15c8340SDag-Erling Smørgrav.Ux Ns -domain 217b15c8340SDag-Erling Smørgravsockets used to contain the connection to the authentication agent. 218a8f6863aSKris KennawayThese sockets should only be readable by the owner. 219a8f6863aSKris KennawayThe sockets should get automatically removed when the agent exits. 220b66f2d16SKris Kennaway.El 221d95e11bfSDag-Erling Smørgrav.Sh SEE ALSO 222d95e11bfSDag-Erling Smørgrav.Xr ssh 1 , 223d95e11bfSDag-Erling Smørgrav.Xr ssh-add 1 , 224d95e11bfSDag-Erling Smørgrav.Xr ssh-keygen 1 , 22519261079SEd Maste.Xr ssh_config 5 , 226d95e11bfSDag-Erling Smørgrav.Xr sshd 8 2271e8db6e2SBrian Feldman.Sh AUTHORS 228ca86bcf2SDag-Erling Smørgrav.An -nosplit 229ca86bcf2SDag-Erling SmørgravOpenSSH is a derivative of the original and free ssh 1.2.12 release by 230ca86bcf2SDag-Erling Smørgrav.An Tatu Ylonen . 231ca86bcf2SDag-Erling Smørgrav.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt 232ca86bcf2SDag-Erling Smørgravand 233ca86bcf2SDag-Erling Smørgrav.An Dug Song 234ca86bcf2SDag-Erling Smørgravremoved many bugs, re-added newer features and created OpenSSH. 235ca86bcf2SDag-Erling Smørgrav.An Markus Friedl 236ca86bcf2SDag-Erling Smørgravcontributed the support for SSH protocol versions 1.5 and 2.0. 237