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