1*a629fefcSchristos.\" $NetBSD: ssh-agent.1,v 1.19 2023/10/25 20:19:57 christos Exp $ 2*a629fefcSchristos.\" $OpenBSD: ssh-agent.1,v 1.79 2023/08/10 14:37:32 naddy Exp $ 3ca32bd8dSchristos.\" 4ca32bd8dSchristos.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 5ca32bd8dSchristos.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 6ca32bd8dSchristos.\" All rights reserved 7ca32bd8dSchristos.\" 8ca32bd8dSchristos.\" As far as I am concerned, the code I have written for this software 9ca32bd8dSchristos.\" can be used freely for any purpose. Any derived versions of this 10ca32bd8dSchristos.\" software must be clearly marked as such, and if the derived work is 11ca32bd8dSchristos.\" incompatible with the protocol description in the RFC file, it must be 12ca32bd8dSchristos.\" called by a name other than "ssh" or "Secure Shell". 13ca32bd8dSchristos.\" 14ca32bd8dSchristos.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 15ca32bd8dSchristos.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 16ca32bd8dSchristos.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 17ca32bd8dSchristos.\" 18ca32bd8dSchristos.\" Redistribution and use in source and binary forms, with or without 19ca32bd8dSchristos.\" modification, are permitted provided that the following conditions 20ca32bd8dSchristos.\" are met: 21ca32bd8dSchristos.\" 1. Redistributions of source code must retain the above copyright 22ca32bd8dSchristos.\" notice, this list of conditions and the following disclaimer. 23ca32bd8dSchristos.\" 2. Redistributions in binary form must reproduce the above copyright 24ca32bd8dSchristos.\" notice, this list of conditions and the following disclaimer in the 25ca32bd8dSchristos.\" documentation and/or other materials provided with the distribution. 26ca32bd8dSchristos.\" 27ca32bd8dSchristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 28ca32bd8dSchristos.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29ca32bd8dSchristos.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30ca32bd8dSchristos.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 31ca32bd8dSchristos.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 32ca32bd8dSchristos.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33ca32bd8dSchristos.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34ca32bd8dSchristos.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35ca32bd8dSchristos.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36ca32bd8dSchristos.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37ca32bd8dSchristos.\" 38*a629fefcSchristos.Dd August 10 2023 39ca32bd8dSchristos.Dt SSH-AGENT 1 40ca32bd8dSchristos.Os 41ca32bd8dSchristos.Sh NAME 42ca32bd8dSchristos.Nm ssh-agent 43ed75d7a8Schristos.Nd OpenSSH authentication agent 44ca32bd8dSchristos.Sh SYNOPSIS 45ca32bd8dSchristos.Nm ssh-agent 46185c8f97Schristos.Op Fl c | s 4779976551Schristos.Op Fl \&Dd 48ca32bd8dSchristos.Op Fl a Ar bind_address 49e4d43b82Schristos.Op Fl E Ar fingerprint_hash 50b1066cf3Schristos.Op Fl O Ar option 512d3b0f52Schristos.Op Fl P Ar allowed_providers 52ca32bd8dSchristos.Op Fl t Ar life 532d3b0f52Schristos.Nm ssh-agent 542d3b0f52Schristos.Op Fl a Ar bind_address 552d3b0f52Schristos.Op Fl E Ar fingerprint_hash 56b1066cf3Schristos.Op Fl O Ar option 572d3b0f52Schristos.Op Fl P Ar allowed_providers 582d3b0f52Schristos.Op Fl t Ar life 592d3b0f52Schristos.Ar command Op Ar arg ... 60ca32bd8dSchristos.Nm ssh-agent 61185c8f97Schristos.Op Fl c | s 62ca32bd8dSchristos.Fl k 63ca32bd8dSchristos.Sh DESCRIPTION 64ca32bd8dSchristos.Nm 65ed75d7a8Schristosis a program to hold private keys used for public key authentication. 66ca32bd8dSchristosThrough use of environment variables the agent can be located 67ca32bd8dSchristosand automatically used for authentication when logging in to other 68ca32bd8dSchristosmachines using 69ca32bd8dSchristos.Xr ssh 1 . 70ca32bd8dSchristos.Pp 71ca32bd8dSchristosThe options are as follows: 72ca32bd8dSchristos.Bl -tag -width Ds 73ca32bd8dSchristos.It Fl a Ar bind_address 7434b27b53SadamBind the agent to the 7534b27b53Sadam.Ux Ns -domain 7634b27b53Sadamsocket 77ca32bd8dSchristos.Ar bind_address . 78ca32bd8dSchristosThe default is 79185c8f97Schristos.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . 80ca32bd8dSchristos.It Fl c 81ca32bd8dSchristosGenerate C-shell commands on 82ca32bd8dSchristos.Dv stdout . 83ca32bd8dSchristosThis is the default if 84ca32bd8dSchristos.Ev SHELL 85ca32bd8dSchristoslooks like it's a csh style of shell. 864054ffb0Schristos.It Fl D 874054ffb0SchristosForeground mode. 88c4271af5SchristosWhen this option is specified, 894054ffb0Schristos.Nm 904054ffb0Schristoswill not fork. 91ca32bd8dSchristos.It Fl d 92ca32bd8dSchristosDebug mode. 93c4271af5SchristosWhen this option is specified, 94ca32bd8dSchristos.Nm 954054ffb0Schristoswill not fork and will write debug information to standard error. 96e4d43b82Schristos.It Fl E Ar fingerprint_hash 97e4d43b82SchristosSpecifies the hash algorithm used when displaying key fingerprints. 98e4d43b82SchristosValid options are: 99e4d43b82Schristos.Dq md5 100e4d43b82Schristosand 101e4d43b82Schristos.Dq sha256 . 102e4d43b82SchristosThe default is 103e4d43b82Schristos.Dq sha256 . 104ca32bd8dSchristos.It Fl k 105ca32bd8dSchristosKill the current agent (given by the 106ca32bd8dSchristos.Ev SSH_AGENT_PID 107ca32bd8dSchristosenvironment variable). 108b1066cf3Schristos.It Fl O Ar option 109b1066cf3SchristosSpecify an option when starting 110b1066cf3Schristos.Nm . 111b1066cf3SchristosCurrently two options are supported: 112b1066cf3Schristos.Cm allow-remote-pkcs11 113b1066cf3Schristosand 114b1066cf3Schristos.Cm no-restrict-websafe . 115b1066cf3Schristos.Pp 116b1066cf3SchristosThe 117b1066cf3Schristos.Cm allow-remote-pkcs11 118b1066cf3Schristosoption allows clients of a forwarded 119b1066cf3Schristos.Nm 120b1066cf3Schristosto load PKCS#11 or FIDO provider libraries. 121b1066cf3SchristosBy default only local clients may perform this operation. 122*a629fefcSchristosNote that signalling that an 123b1066cf3Schristos.Nm 124*a629fefcSchristosclient is remote is performed by 125b1066cf3Schristos.Xr ssh 1 , 126b1066cf3Schristosand use of other tools to forward access to the agent socket may circumvent 127b1066cf3Schristosthis restriction. 128b1066cf3Schristos.Pp 129b1066cf3SchristosThe 130*a629fefcSchristos.Cm no-restrict-websafe 131*a629fefcSchristosoption instructs 132b1066cf3Schristos.Nm 133b1066cf3Schristosto permit signatures using FIDO keys that might be web authentication 134b1066cf3Schristosrequests. 135b1066cf3SchristosBy default, 136b1066cf3Schristos.Nm 137b1066cf3Schristosrefuses signature requests for FIDO keys where the key application string 138b1066cf3Schristosdoes not start with 139b1066cf3Schristos.Dq ssh: 140b1066cf3Schristosand when the data to be signed does not appear to be a 141b1066cf3Schristos.Xr ssh 1 142b1066cf3Schristosuser authentication request or a 143b1066cf3Schristos.Xr ssh-keygen 1 144b1066cf3Schristossignature. 145b1066cf3SchristosThe default behaviour prevents forwarded access to a FIDO key from also 146b1066cf3Schristosimplicitly forwarding the ability to authenticate to websites. 1472d3b0f52Schristos.It Fl P Ar allowed_providers 1482d3b0f52SchristosSpecify a pattern-list of acceptable paths for PKCS#11 provider and FIDO 1492d3b0f52Schristosauthenticator middleware shared libraries that may be used with the 150ed75d7a8Schristos.Fl S 151ed75d7a8Schristosor 152ee85abc4Schristos.Fl s 153ed75d7a8Schristosoptions to 154ee85abc4Schristos.Xr ssh-add 1 . 1552d3b0f52SchristosLibraries that do not match the pattern list will be refused. 156ee85abc4SchristosSee PATTERNS in 157ee85abc4Schristos.Xr ssh_config 5 158ee85abc4Schristosfor a description of pattern-list syntax. 1592d3b0f52SchristosThe default list is 160ed75d7a8Schristos.Dq /usr/lib/*,/usr/local/lib/* . 161ca32bd8dSchristos.It Fl s 162ca32bd8dSchristosGenerate Bourne shell commands on 163ca32bd8dSchristos.Dv stdout . 164ca32bd8dSchristosThis is the default if 165ca32bd8dSchristos.Ev SHELL 166ca32bd8dSchristosdoes not look like it's a csh style of shell. 167ca32bd8dSchristos.It Fl t Ar life 168ca32bd8dSchristosSet a default value for the maximum lifetime of identities added to the agent. 169ca32bd8dSchristosThe lifetime may be specified in seconds or in a time format specified in 170ca32bd8dSchristos.Xr sshd_config 5 . 171ca32bd8dSchristosA lifetime specified for an identity with 172ca32bd8dSchristos.Xr ssh-add 1 173ca32bd8dSchristosoverrides this value. 174ca32bd8dSchristosWithout this option the default maximum lifetime is forever. 175ed75d7a8Schristos.It Ar command Op Ar arg ... 176ed75d7a8SchristosIf a command (and optional arguments) is given, 177ed75d7a8Schristosthis is executed as a subprocess of the agent. 178ca32bd8dSchristosThe agent exits automatically when the command given on the command 179ca32bd8dSchristosline terminates. 180ed75d7a8Schristos.El 181ed75d7a8Schristos.Pp 182ed75d7a8SchristosThere are two main ways to get an agent set up. 183ed75d7a8SchristosThe first is at the start of an X session, 184ed75d7a8Schristoswhere all other windows or programs are started as children of the 185ed75d7a8Schristos.Nm 186ed75d7a8Schristosprogram. 187ed75d7a8SchristosThe agent starts a command under which its environment 188ed75d7a8Schristosvariables are exported, for example 189ed75d7a8Schristos.Cm ssh-agent xterm & . 190ed75d7a8SchristosWhen the command terminates, so does the agent. 191ed75d7a8Schristos.Pp 192ed75d7a8SchristosThe second method is used for a login session. 193ed75d7a8SchristosWhen 194ed75d7a8Schristos.Nm 195ed75d7a8Schristosis started, 196ed75d7a8Schristosit prints the shell commands required to set its environment variables, 197ed75d7a8Schristoswhich in turn can be evaluated in the calling shell, for example 198ed75d7a8Schristos.Cm eval `ssh-agent -s` . 199ed75d7a8Schristos.Pp 200ed75d7a8SchristosIn both cases, 201ed75d7a8Schristos.Xr ssh 1 202b1066cf3Schristoslooks at these environment variables 203b1066cf3Schristosand uses them to establish a connection to the agent. 204ed75d7a8Schristos.Pp 205ed75d7a8SchristosThe agent initially does not have any private keys. 206ed75d7a8SchristosKeys are added using 207ed75d7a8Schristos.Xr ssh-add 1 208ed75d7a8Schristosor by 209ed75d7a8Schristos.Xr ssh 1 210ed75d7a8Schristoswhen 211ed75d7a8Schristos.Cm AddKeysToAgent 212ed75d7a8Schristosis set in 213ed75d7a8Schristos.Xr ssh_config 5 . 214ed75d7a8SchristosMultiple identities may be stored in 215ed75d7a8Schristos.Nm 216ed75d7a8Schristosconcurrently and 217ed75d7a8Schristos.Xr ssh 1 218ed75d7a8Schristoswill automatically use them if present. 219ed75d7a8Schristos.Xr ssh-add 1 220ed75d7a8Schristosis also used to remove keys from 221ed75d7a8Schristos.Nm 222ed75d7a8Schristosand to query the keys that are held in one. 223ed75d7a8Schristos.Pp 224ed75d7a8SchristosConnections to 225ed75d7a8Schristos.Nm 226ed75d7a8Schristosmay be forwarded from further remote hosts using the 227ed75d7a8Schristos.Fl A 228ed75d7a8Schristosoption to 229ed75d7a8Schristos.Xr ssh 1 230ed75d7a8Schristos(but see the caveats documented therein), 231ed75d7a8Schristosavoiding the need for authentication data to be stored on other machines. 232ed75d7a8SchristosAuthentication passphrases and private keys never go over the network: 233ed75d7a8Schristosthe connection to the agent is forwarded over SSH remote connections 234ed75d7a8Schristosand the result is returned to the requester, 235ed75d7a8Schristosallowing the user access to their identities anywhere in the network 236ed75d7a8Schristosin a secure fashion. 237ed75d7a8Schristos.Sh ENVIRONMENT 238ed75d7a8Schristos.Bl -tag -width "SSH_AGENT_PID" 239ed75d7a8Schristos.It Ev SSH_AGENT_PID 240ed75d7a8SchristosWhen 241ed75d7a8Schristos.Nm 242ed75d7a8Schristosstarts, it stores the name of the agent's process ID (PID) in this variable. 243ed75d7a8Schristos.It Ev SSH_AUTH_SOCK 244ed75d7a8SchristosWhen 245ed75d7a8Schristos.Nm 246ed75d7a8Schristosstarts, it creates a 247ed75d7a8Schristos.Ux Ns -domain 248ed75d7a8Schristossocket and stores its pathname in this variable. 249ed75d7a8SchristosIt is accessible only to the current user, 250ed75d7a8Schristosbut is easily abused by root or another instance of the same user. 251ed75d7a8Schristos.El 252ca32bd8dSchristos.Sh FILES 253ca32bd8dSchristos.Bl -tag -width Ds 254ee85abc4Schristos.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid> 25534b27b53Sadam.Ux Ns -domain 25634b27b53Sadamsockets used to contain the connection to the authentication agent. 257ca32bd8dSchristosThese sockets should only be readable by the owner. 258ca32bd8dSchristosThe sockets should get automatically removed when the agent exits. 259ca32bd8dSchristos.El 260ca32bd8dSchristos.Sh SEE ALSO 261ca32bd8dSchristos.Xr ssh 1 , 262ca32bd8dSchristos.Xr ssh-add 1 , 263ca32bd8dSchristos.Xr ssh-keygen 1 , 264ed75d7a8Schristos.Xr ssh_config 5 , 265ca32bd8dSchristos.Xr sshd 8 266ca32bd8dSchristos.Sh AUTHORS 267ee85abc4Schristos.An -nosplit 268ee85abc4SchristosOpenSSH is a derivative of the original and free ssh 1.2.12 release by 269ee85abc4Schristos.An Tatu Ylonen . 270ee85abc4Schristos.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt 271ee85abc4Schristosand 272ee85abc4Schristos.An Dug Song 273ee85abc4Schristosremoved many bugs, re-added newer features and created OpenSSH. 274ee85abc4Schristos.An Markus Friedl 275ee85abc4Schristoscontributed the support for SSH protocol versions 1.5 and 2.0. 276