1*4a421b63SDag-Erling Smørgrav.\" $OpenBSD: ssh-agent.1,v 1.53 2010/11/21 01:01:13 djm Exp $ 27aee6ffeSDag-Erling Smørgrav.\" $FreeBSD$ 3511b41d2SMark Murray.\" 4511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 5511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 6511b41d2SMark Murray.\" All rights reserved 7511b41d2SMark Murray.\" 8b66f2d16SKris Kennaway.\" As far as I am concerned, the code I have written for this software 9b66f2d16SKris Kennaway.\" can be used freely for any purpose. Any derived versions of this 10b66f2d16SKris Kennaway.\" software must be clearly marked as such, and if the derived work is 11b66f2d16SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be 12b66f2d16SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell". 13b66f2d16SKris Kennaway.\" 14b66f2d16SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 15b66f2d16SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 16b66f2d16SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 17b66f2d16SKris Kennaway.\" 18b66f2d16SKris Kennaway.\" Redistribution and use in source and binary forms, with or without 19b66f2d16SKris Kennaway.\" modification, are permitted provided that the following conditions 20b66f2d16SKris Kennaway.\" are met: 21b66f2d16SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright 22b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer. 23b66f2d16SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright 24b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer in the 25b66f2d16SKris Kennaway.\" documentation and/or other materials provided with the distribution. 26b66f2d16SKris Kennaway.\" 27b66f2d16SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 28b66f2d16SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29b66f2d16SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30b66f2d16SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 31b66f2d16SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 32b66f2d16SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33b66f2d16SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34b66f2d16SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35b66f2d16SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36b66f2d16SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37511b41d2SMark Murray.\" 38*4a421b63SDag-Erling Smørgrav.Dd November 21, 2010 39511b41d2SMark Murray.Dt SSH-AGENT 1 40511b41d2SMark Murray.Os 41511b41d2SMark Murray.Sh NAME 42511b41d2SMark Murray.Nm ssh-agent 43511b41d2SMark Murray.Nd authentication agent 44511b41d2SMark Murray.Sh SYNOPSIS 45511b41d2SMark Murray.Nm ssh-agent 46*4a421b63SDag-Erling Smørgrav.Op Fl c | s 47ae1f160dSDag-Erling Smørgrav.Op Fl d 48d4af9e69SDag-Erling Smørgrav.Op Fl a Ar bind_address 49d4af9e69SDag-Erling Smørgrav.Op Fl t Ar life 50d4af9e69SDag-Erling Smørgrav.Op Ar command Op Ar arg ... 511e8db6e2SBrian Feldman.Nm ssh-agent 52*4a421b63SDag-Erling Smørgrav.Op Fl c | s 531e8db6e2SBrian Feldman.Fl k 54511b41d2SMark Murray.Sh DESCRIPTION 55511b41d2SMark Murray.Nm 56b66f2d16SKris Kennawayis a program to hold private keys used for public key authentication 57*4a421b63SDag-Erling Smørgrav(RSA, DSA, ECDSA). 58a8f6863aSKris KennawayThe idea is that 59511b41d2SMark Murray.Nm 60511b41d2SMark Murrayis started in the beginning of an X-session or a login session, and 61511b41d2SMark Murrayall other windows or programs are started as clients to the ssh-agent 62a8f6863aSKris Kennawayprogram. 63a8f6863aSKris KennawayThrough use of environment variables the agent can be located 64b66f2d16SKris Kennawayand automatically used for authentication when logging in to other 65511b41d2SMark Murraymachines using 66511b41d2SMark Murray.Xr ssh 1 . 67511b41d2SMark Murray.Pp 68511b41d2SMark MurrayThe options are as follows: 69511b41d2SMark Murray.Bl -tag -width Ds 70545d5ecaSDag-Erling Smørgrav.It Fl a Ar bind_address 71b15c8340SDag-Erling SmørgravBind the agent to the 72b15c8340SDag-Erling Smørgrav.Ux Ns -domain 73b15c8340SDag-Erling Smørgravsocket 74545d5ecaSDag-Erling Smørgrav.Ar bind_address . 75545d5ecaSDag-Erling SmørgravThe default is 76*4a421b63SDag-Erling Smørgrav.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . 77511b41d2SMark Murray.It Fl c 78511b41d2SMark MurrayGenerate C-shell commands on 79511b41d2SMark Murray.Dv stdout . 80511b41d2SMark MurrayThis is the default if 81511b41d2SMark Murray.Ev SHELL 82511b41d2SMark Murraylooks like it's a csh style of shell. 83d4af9e69SDag-Erling Smørgrav.It Fl d 84d4af9e69SDag-Erling SmørgravDebug mode. 85d4af9e69SDag-Erling SmørgravWhen this option is specified 86d4af9e69SDag-Erling Smørgrav.Nm 87d4af9e69SDag-Erling Smørgravwill not fork. 88d4af9e69SDag-Erling Smørgrav.It Fl k 89d4af9e69SDag-Erling SmørgravKill the current agent (given by the 90d4af9e69SDag-Erling Smørgrav.Ev SSH_AGENT_PID 91d4af9e69SDag-Erling Smørgravenvironment variable). 92511b41d2SMark Murray.It Fl s 93511b41d2SMark MurrayGenerate Bourne shell commands on 94511b41d2SMark Murray.Dv stdout . 95511b41d2SMark MurrayThis is the default if 96511b41d2SMark Murray.Ev SHELL 97511b41d2SMark Murraydoes not look like it's a csh style of shell. 98d0c8c0bcSDag-Erling Smørgrav.It Fl t Ar life 99d0c8c0bcSDag-Erling SmørgravSet a default value for the maximum lifetime of identities added to the agent. 100d0c8c0bcSDag-Erling SmørgravThe lifetime may be specified in seconds or in a time format specified in 101021d409fSDag-Erling Smørgrav.Xr sshd_config 5 . 102d0c8c0bcSDag-Erling SmørgravA lifetime specified for an identity with 103d0c8c0bcSDag-Erling Smørgrav.Xr ssh-add 1 104d0c8c0bcSDag-Erling Smørgravoverrides this value. 105d0c8c0bcSDag-Erling SmørgravWithout this option the default maximum lifetime is forever. 106511b41d2SMark Murray.El 107511b41d2SMark Murray.Pp 108511b41d2SMark MurrayIf a commandline is given, this is executed as a subprocess of the agent. 109511b41d2SMark MurrayWhen the command dies, so does the agent. 110511b41d2SMark Murray.Pp 111a8f6863aSKris KennawayThe agent initially does not have any private keys. 112a8f6863aSKris KennawayKeys are added using 113511b41d2SMark Murray.Xr ssh-add 1 . 114511b41d2SMark MurrayWhen executed without arguments, 115511b41d2SMark Murray.Xr ssh-add 1 116ae1f160dSDag-Erling Smørgravadds the files 117043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_rsa , 118*4a421b63SDag-Erling Smørgrav.Pa ~/.ssh/id_dsa , 119*4a421b63SDag-Erling Smørgrav.Pa ~/.ssh/id_ecdsa 120ae1f160dSDag-Erling Smørgravand 121043840dfSDag-Erling Smørgrav.Pa ~/.ssh/identity . 122a8f6863aSKris KennawayIf the identity has a passphrase, 123511b41d2SMark Murray.Xr ssh-add 1 124b15c8340SDag-Erling Smørgravasks for the passphrase on the terminal if it has one or from a small X11 125b15c8340SDag-Erling Smørgravprogram if running under X11. 126b15c8340SDag-Erling SmørgravIf neither of these is the case then the authentication will fail. 127a8f6863aSKris KennawayIt then sends the identity to the agent. 128a8f6863aSKris KennawaySeveral identities can be stored in the 129511b41d2SMark Murrayagent; the agent can automatically use any of these identities. 130511b41d2SMark Murray.Ic ssh-add -l 131511b41d2SMark Murraydisplays the identities currently held by the agent. 132511b41d2SMark Murray.Pp 133511b41d2SMark MurrayThe idea is that the agent is run in the user's local PC, laptop, or 134a8f6863aSKris Kennawayterminal. 135a8f6863aSKris KennawayAuthentication data need not be stored on any other 136511b41d2SMark Murraymachine, and authentication passphrases never go over the network. 137511b41d2SMark MurrayHowever, the connection to the agent is forwarded over SSH 138511b41d2SMark Murrayremote logins, and the user can thus use the privileges given by the 139511b41d2SMark Murrayidentities anywhere in the network in a secure way. 140511b41d2SMark Murray.Pp 141a8f6863aSKris KennawayThere are two main ways to get an agent set up: 142d74d50a8SDag-Erling SmørgravThe first is that the agent starts a new subcommand into which some environment 143d74d50a8SDag-Erling Smørgravvariables are exported, eg 144d74d50a8SDag-Erling Smørgrav.Cm ssh-agent xterm & . 145d74d50a8SDag-Erling SmørgravThe second is that the agent prints the needed shell commands (either 146511b41d2SMark Murray.Xr sh 1 147511b41d2SMark Murrayor 148511b41d2SMark Murray.Xr csh 1 1497aee6ffeSDag-Erling Smørgravsyntax can be generated) which can be evaluated in the calling shell, eg 150d74d50a8SDag-Erling Smørgrav.Cm eval `ssh-agent -s` 151d74d50a8SDag-Erling Smørgravfor Bourne-type shells such as 152d74d50a8SDag-Erling Smørgrav.Xr sh 1 153d74d50a8SDag-Erling Smørgravor 154d74d50a8SDag-Erling Smørgrav.Xr ksh 1 155d74d50a8SDag-Erling Smørgravand 156d74d50a8SDag-Erling Smørgrav.Cm eval `ssh-agent -c` 157d74d50a8SDag-Erling Smørgravfor 158d74d50a8SDag-Erling Smørgrav.Xr csh 1 159d74d50a8SDag-Erling Smørgravand derivatives. 160d74d50a8SDag-Erling Smørgrav.Pp 161511b41d2SMark MurrayLater 162511b41d2SMark Murray.Xr ssh 1 1631e8db6e2SBrian Feldmanlooks at these variables and uses them to establish a connection to the agent. 164511b41d2SMark Murray.Pp 165ae1f160dSDag-Erling SmørgravThe agent will never send a private key over its request channel. 166ae1f160dSDag-Erling SmørgravInstead, operations that require a private key will be performed 167ae1f160dSDag-Erling Smørgravby the agent, and the result will be returned to the requester. 168ae1f160dSDag-Erling SmørgravThis way, private keys are not exposed to clients using the agent. 169ae1f160dSDag-Erling Smørgrav.Pp 170b15c8340SDag-Erling SmørgravA 171b15c8340SDag-Erling Smørgrav.Ux Ns -domain 172b15c8340SDag-Erling Smørgravsocket is created and the name of this socket is stored in the 173511b41d2SMark Murray.Ev SSH_AUTH_SOCK 174511b41d2SMark Murrayenvironment 175a8f6863aSKris Kennawayvariable. 176a8f6863aSKris KennawayThe socket is made accessible only to the current user. 177511b41d2SMark MurrayThis method is easily abused by root or another instance of the same 178511b41d2SMark Murrayuser. 179511b41d2SMark Murray.Pp 180511b41d2SMark MurrayThe 181511b41d2SMark Murray.Ev SSH_AGENT_PID 182ee21a45fSDag-Erling Smørgravenvironment variable holds the agent's process ID. 183511b41d2SMark Murray.Pp 184511b41d2SMark MurrayThe agent exits automatically when the command given on the command 185511b41d2SMark Murrayline terminates. 186511b41d2SMark Murray.Sh FILES 187511b41d2SMark Murray.Bl -tag -width Ds 188043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/identity 1891e8db6e2SBrian FeldmanContains the protocol version 1 RSA authentication identity of the user. 190043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa 1911e8db6e2SBrian FeldmanContains the protocol version 2 DSA authentication identity of the user. 192*4a421b63SDag-Erling Smørgrav.It Pa ~/.ssh/id_ecdsa 193*4a421b63SDag-Erling SmørgravContains the protocol version 2 ECDSA authentication identity of the user. 194043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa 1951e8db6e2SBrian FeldmanContains the protocol version 2 RSA authentication identity of the user. 196*4a421b63SDag-Erling Smørgrav.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt 197b15c8340SDag-Erling Smørgrav.Ux Ns -domain 198b15c8340SDag-Erling Smørgravsockets used to contain the connection to the authentication agent. 199a8f6863aSKris KennawayThese sockets should only be readable by the owner. 200a8f6863aSKris KennawayThe sockets should get automatically removed when the agent exits. 201b66f2d16SKris Kennaway.El 202d95e11bfSDag-Erling Smørgrav.Sh SEE ALSO 203d95e11bfSDag-Erling Smørgrav.Xr ssh 1 , 204d95e11bfSDag-Erling Smørgrav.Xr ssh-add 1 , 205d95e11bfSDag-Erling Smørgrav.Xr ssh-keygen 1 , 206d95e11bfSDag-Erling Smørgrav.Xr sshd 8 2071e8db6e2SBrian Feldman.Sh AUTHORS 2081e8db6e2SBrian FeldmanOpenSSH is a derivative of the original and free 2091e8db6e2SBrian Feldmanssh 1.2.12 release by Tatu Ylonen. 2101e8db6e2SBrian FeldmanAaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 2111e8db6e2SBrian FeldmanTheo de Raadt and Dug Song 2121e8db6e2SBrian Feldmanremoved many bugs, re-added newer features and 2131e8db6e2SBrian Feldmancreated OpenSSH. 2141e8db6e2SBrian FeldmanMarkus Friedl contributed the support for SSH 2151e8db6e2SBrian Feldmanprotocol versions 1.5 and 2.0. 216