1.\" $OpenBSD: ssh-agent.1,v 1.47 2009/03/26 08:38:39 sobrado Exp $ 2.\" $FreeBSD$ 3.\" 4.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 5.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 6.\" All rights reserved 7.\" 8.\" As far as I am concerned, the code I have written for this software 9.\" can be used freely for any purpose. Any derived versions of this 10.\" software must be clearly marked as such, and if the derived work is 11.\" incompatible with the protocol description in the RFC file, it must be 12.\" called by a name other than "ssh" or "Secure Shell". 13.\" 14.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 15.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 16.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 17.\" 18.\" Redistribution and use in source and binary forms, with or without 19.\" modification, are permitted provided that the following conditions 20.\" are met: 21.\" 1. Redistributions of source code must retain the above copyright 22.\" notice, this list of conditions and the following disclaimer. 23.\" 2. Redistributions in binary form must reproduce the above copyright 24.\" notice, this list of conditions and the following disclaimer in the 25.\" documentation and/or other materials provided with the distribution. 26.\" 27.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 28.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 31.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 32.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37.\" 38.Dd March 26 2009 39.Dt SSH-AGENT 1 40.Os 41.Sh NAME 42.Nm ssh-agent 43.Nd authentication agent 44.Sh SYNOPSIS 45.Nm ssh-agent 46.Op Fl c Li | Fl s 47.Op Fl d 48.Op Fl a Ar bind_address 49.Op Fl t Ar life 50.Op Ar command Op Ar arg ... 51.Nm ssh-agent 52.Op Fl c Li | Fl s 53.Fl k 54.Sh DESCRIPTION 55.Nm 56is a program to hold private keys used for public key authentication 57(RSA, DSA). 58The idea is that 59.Nm 60is started in the beginning of an X-session or a login session, and 61all other windows or programs are started as clients to the ssh-agent 62program. 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 unix-domain socket 72.Ar bind_address . 73The default is 74.Pa /tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . 75.It Fl c 76Generate C-shell commands on 77.Dv stdout . 78This is the default if 79.Ev SHELL 80looks like it's a csh style of shell. 81.It Fl d 82Debug mode. 83When this option is specified 84.Nm 85will not fork. 86.It Fl k 87Kill the current agent (given by the 88.Ev SSH_AGENT_PID 89environment variable). 90.It Fl s 91Generate Bourne shell commands on 92.Dv stdout . 93This is the default if 94.Ev SHELL 95does not look like it's a csh style of shell. 96.It Fl t Ar life 97Set a default value for the maximum lifetime of identities added to the agent. 98The lifetime may be specified in seconds or in a time format specified in 99.Xr sshd_config 5 . 100A lifetime specified for an identity with 101.Xr ssh-add 1 102overrides this value. 103Without this option the default maximum lifetime is forever. 104.El 105.Pp 106If a commandline is given, this is executed as a subprocess of the agent. 107When the command dies, so does the agent. 108.Pp 109The agent initially does not have any private keys. 110Keys are added using 111.Xr ssh-add 1 . 112When executed without arguments, 113.Xr ssh-add 1 114adds the files 115.Pa ~/.ssh/id_rsa , 116.Pa ~/.ssh/id_dsa 117and 118.Pa ~/.ssh/identity . 119If the identity has a passphrase, 120.Xr ssh-add 1 121asks for the passphrase (using a small X11 application if running 122under X11, or from the terminal if running without X). 123It then sends the identity to the agent. 124Several identities can be stored in the 125agent; the agent can automatically use any of these identities. 126.Ic ssh-add -l 127displays the identities currently held by the agent. 128.Pp 129The idea is that the agent is run in the user's local PC, laptop, or 130terminal. 131Authentication data need not be stored on any other 132machine, and authentication passphrases never go over the network. 133However, the connection to the agent is forwarded over SSH 134remote logins, and the user can thus use the privileges given by the 135identities anywhere in the network in a secure way. 136.Pp 137There are two main ways to get an agent set up: 138The first is that the agent starts a new subcommand into which some environment 139variables are exported, eg 140.Cm ssh-agent xterm & . 141The second is that the agent prints the needed shell commands (either 142.Xr sh 1 143or 144.Xr csh 1 145syntax can be generated) which can be evaluated in the calling shell, eg 146.Cm eval `ssh-agent -s` 147for Bourne-type shells such as 148.Xr sh 1 149or 150.Xr ksh 1 151and 152.Cm eval `ssh-agent -c` 153for 154.Xr csh 1 155and derivatives. 156.Pp 157Later 158.Xr ssh 1 159looks at these variables and uses them to establish a connection to the agent. 160.Pp 161The agent will never send a private key over its request channel. 162Instead, operations that require a private key will be performed 163by the agent, and the result will be returned to the requester. 164This way, private keys are not exposed to clients using the agent. 165.Pp 166A unix-domain socket is created 167and the name of this socket is stored in the 168.Ev SSH_AUTH_SOCK 169environment 170variable. 171The socket is made accessible only to the current user. 172This method is easily abused by root or another instance of the same 173user. 174.Pp 175The 176.Ev SSH_AGENT_PID 177environment variable holds the agent's process ID. 178.Pp 179The agent exits automatically when the command given on the command 180line terminates. 181.Sh FILES 182.Bl -tag -width Ds 183.It Pa ~/.ssh/identity 184Contains the protocol version 1 RSA authentication identity of the user. 185.It Pa ~/.ssh/id_dsa 186Contains the protocol version 2 DSA authentication identity of the user. 187.It Pa ~/.ssh/id_rsa 188Contains the protocol version 2 RSA authentication identity of the user. 189.It Pa /tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt 190Unix-domain sockets used to contain the connection to the 191authentication agent. 192These sockets should only be readable by the owner. 193The sockets should get automatically removed when the agent exits. 194.El 195.Sh SEE ALSO 196.Xr ssh 1 , 197.Xr ssh-add 1 , 198.Xr ssh-keygen 1 , 199.Xr sshd 8 200.Sh AUTHORS 201OpenSSH is a derivative of the original and free 202ssh 1.2.12 release by Tatu Ylonen. 203Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 204Theo de Raadt and Dug Song 205removed many bugs, re-added newer features and 206created OpenSSH. 207Markus Friedl contributed the support for SSH 208protocol versions 1.5 and 2.0. 209