1.\" $OpenBSD: ssh-agent.1,v 1.81 2024/11/06 22:51:26 djm 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: November 6 2024 $ 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 \&Dd 47.Op Fl a Ar bind_address 48.Op Fl E Ar fingerprint_hash 49.Op Fl O Ar option 50.Op Fl P Ar allowed_providers 51.Op Fl t Ar life 52.Nm ssh-agent 53.Op Fl a Ar bind_address 54.Op Fl E Ar fingerprint_hash 55.Op Fl O Ar option 56.Op Fl P Ar allowed_providers 57.Op Fl t Ar life 58.Ar command Op Ar arg ... 59.Nm ssh-agent 60.Op Fl c | s 61.Fl k 62.Sh DESCRIPTION 63.Nm 64is a program to hold private keys used for public key authentication. 65Through use of environment variables the agent can be located 66and automatically used for authentication when logging in to other 67machines using 68.Xr ssh 1 . 69.Pp 70The options are as follows: 71.Bl -tag -width Ds 72.It Fl a Ar bind_address 73Bind the agent to the 74.Ux Ns -domain 75socket 76.Ar bind_address . 77The default is 78.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . 79.It Fl c 80Generate C-shell commands on 81.Dv stdout . 82This is the default if 83.Ev SHELL 84looks like it's a csh style of shell. 85.It Fl D 86Foreground mode. 87When this option is specified, 88.Nm 89will not fork. 90.It Fl d 91Debug mode. 92When this option is specified, 93.Nm 94will not fork and will write debug information to standard error. 95.It Fl E Ar fingerprint_hash 96Specifies the hash algorithm used when displaying key fingerprints. 97Valid options are: 98.Dq md5 99and 100.Dq sha256 . 101The default is 102.Dq sha256 . 103.It Fl k 104Kill the current agent (given by the 105.Ev SSH_AGENT_PID 106environment variable). 107.It Fl O Ar option 108Specify an option when starting 109.Nm . 110The supported options are: 111.Cm allow-remote-pkcs11 , 112.Cm no-restrict-websafe 113and 114.Cm websafe-allow . 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.Pp 148Alternately the 149.Cm websafe-allow 150option allows specifying a pattern-list of key application strings to 151replace the default application allow-list, for example: 152.Dq websafe-allow=ssh:*,example.org,*.example.com 153.Pp 154See PATTERNS in 155.Xr ssh_config 5 156for a description of pattern-list syntax. 157.It Fl P Ar allowed_providers 158Specify a pattern-list of acceptable paths for PKCS#11 provider and FIDO 159authenticator middleware shared libraries that may be used with the 160.Fl S 161or 162.Fl s 163options to 164.Xr ssh-add 1 . 165Libraries that do not match the pattern list will be refused. 166The default list is 167.Dq /usr/lib/*,/usr/local/lib/* . 168.Pp 169See PATTERNS in 170.Xr ssh_config 5 171for a description of pattern-list syntax. 172.It Fl s 173Generate Bourne shell commands on 174.Dv stdout . 175This is the default if 176.Ev SHELL 177does not look like it's a csh style of shell. 178.It Fl t Ar life 179Set a default value for the maximum lifetime of identities added to the agent. 180The lifetime may be specified in seconds or in a time format specified in 181.Xr sshd_config 5 . 182A lifetime specified for an identity with 183.Xr ssh-add 1 184overrides this value. 185Without this option the default maximum lifetime is forever. 186.It Ar command Op Ar arg ... 187If a command (and optional arguments) is given, 188this is executed as a subprocess of the agent. 189The agent exits automatically when the command given on the command 190line terminates. 191.El 192.Pp 193There are two main ways to get an agent set up. 194The first is at the start of an X session, 195where all other windows or programs are started as children of the 196.Nm 197program. 198The agent starts a command under which its environment 199variables are exported, for example 200.Cm ssh-agent xterm & . 201When the command terminates, so does the agent. 202.Pp 203The second method is used for a login session. 204When 205.Nm 206is started, 207it prints the shell commands required to set its environment variables, 208which in turn can be evaluated in the calling shell, for example 209.Cm eval `ssh-agent -s` . 210.Pp 211In both cases, 212.Xr ssh 1 213looks at these environment variables 214and uses them to establish a connection to the agent. 215.Pp 216The agent initially does not have any private keys. 217Keys are added using 218.Xr ssh-add 1 219or by 220.Xr ssh 1 221when 222.Cm AddKeysToAgent 223is set in 224.Xr ssh_config 5 . 225Multiple identities may be stored in 226.Nm 227concurrently and 228.Xr ssh 1 229will automatically use them if present. 230.Xr ssh-add 1 231is also used to remove keys from 232.Nm 233and to query the keys that are held in one. 234.Pp 235Connections to 236.Nm 237may be forwarded from further remote hosts using the 238.Fl A 239option to 240.Xr ssh 1 241(but see the caveats documented therein), 242avoiding the need for authentication data to be stored on other machines. 243Authentication passphrases and private keys never go over the network: 244the connection to the agent is forwarded over SSH remote connections 245and the result is returned to the requester, 246allowing the user access to their identities anywhere in the network 247in a secure fashion. 248.Pp 249.Nm 250will delete all keys it has loaded upon receiving 251.Dv SIGUSR1 . 252.Sh ENVIRONMENT 253.Bl -tag -width "SSH_AGENT_PID" 254.It Ev SSH_AGENT_PID 255When 256.Nm 257starts, it stores the name of the agent's process ID (PID) in this variable. 258.It Ev SSH_AUTH_SOCK 259When 260.Nm 261starts, it creates a 262.Ux Ns -domain 263socket and stores its pathname in this variable. 264It is accessible only to the current user, 265but is easily abused by root or another instance of the same user. 266.El 267.Sh FILES 268.Bl -tag -width Ds 269.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid> 270.Ux Ns -domain 271sockets used to contain the connection to the authentication agent. 272These sockets should only be readable by the owner. 273The sockets should get automatically removed when the agent exits. 274.El 275.Sh SEE ALSO 276.Xr ssh 1 , 277.Xr ssh-add 1 , 278.Xr ssh-keygen 1 , 279.Xr ssh_config 5 , 280.Xr sshd 8 281.Sh AUTHORS 282.An -nosplit 283OpenSSH is a derivative of the original and free ssh 1.2.12 release by 284.An Tatu Ylonen . 285.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt 286and 287.An Dug Song 288removed many bugs, re-added newer features and created OpenSSH. 289.An Markus Friedl 290contributed the support for SSH protocol versions 1.5 and 2.0. 291