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