xref: /openbsd-src/usr.bin/ssh/ssh-agent.1 (revision 91f110e064cd7c194e59e019b83bb7496c1c84d4)
1.\" $OpenBSD: ssh-agent.1,v 1.54 2013/12/07 11:58:46 naddy 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: December 7 2013 $
38.Dt SSH-AGENT 1
39.Os
40.Sh NAME
41.Nm ssh-agent
42.Nd authentication agent
43.Sh SYNOPSIS
44.Nm ssh-agent
45.Op Fl c | s
46.Op Fl d
47.Op Fl a Ar bind_address
48.Op Fl t Ar life
49.Op Ar command Op Ar arg ...
50.Nm ssh-agent
51.Op Fl c | s
52.Fl k
53.Sh DESCRIPTION
54.Nm
55is a program to hold private keys used for public key authentication
56(RSA, DSA, ECDSA, ED25519).
57The idea is that
58.Nm
59is started in the beginning of an X-session or a login session, and
60all other windows or programs are started as clients to the ssh-agent
61program.
62Through use of environment variables the agent can be located
63and automatically used for authentication when logging in to other
64machines using
65.Xr ssh 1 .
66.Pp
67The options are as follows:
68.Bl -tag -width Ds
69.It Fl a Ar bind_address
70Bind the agent to the
71.Ux Ns -domain
72socket
73.Ar bind_address .
74The default is
75.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt .
76.It Fl c
77Generate C-shell commands on
78.Dv stdout .
79This is the default if
80.Ev SHELL
81looks like it's a csh style of shell.
82.It Fl d
83Debug mode.
84When this option is specified
85.Nm
86will not fork.
87.It Fl k
88Kill the current agent (given by the
89.Ev SSH_AGENT_PID
90environment variable).
91.It Fl s
92Generate Bourne shell commands on
93.Dv stdout .
94This is the default if
95.Ev SHELL
96does not look like it's a csh style of shell.
97.It Fl t Ar life
98Set a default value for the maximum lifetime of identities added to the agent.
99The lifetime may be specified in seconds or in a time format specified in
100.Xr sshd_config 5 .
101A lifetime specified for an identity with
102.Xr ssh-add 1
103overrides this value.
104Without this option the default maximum lifetime is forever.
105.El
106.Pp
107If a commandline is given, this is executed as a subprocess of the agent.
108When the command dies, so does the agent.
109.Pp
110The agent initially does not have any private keys.
111Keys are added using
112.Xr ssh-add 1 .
113When executed without arguments,
114.Xr ssh-add 1
115adds the files
116.Pa ~/.ssh/id_rsa ,
117.Pa ~/.ssh/id_dsa ,
118.Pa ~/.ssh/id_ecdsa ,
119.Pa ~/.ssh/id_ed25519
120and
121.Pa ~/.ssh/identity .
122If the identity has a passphrase,
123.Xr ssh-add 1
124asks for the passphrase on the terminal if it has one or from a small X11
125program if running under X11.
126If neither of these is the case then the authentication will fail.
127It then sends the identity to the agent.
128Several identities can be stored in the
129agent; the agent can automatically use any of these identities.
130.Ic ssh-add -l
131displays the identities currently held by the agent.
132.Pp
133The idea is that the agent is run in the user's local PC, laptop, or
134terminal.
135Authentication data need not be stored on any other
136machine, and authentication passphrases never go over the network.
137However, the connection to the agent is forwarded over SSH
138remote logins, and the user can thus use the privileges given by the
139identities anywhere in the network in a secure way.
140.Pp
141There are two main ways to get an agent set up:
142The first is that the agent starts a new subcommand into which some environment
143variables are exported, eg
144.Cm ssh-agent xterm & .
145The second is that the agent prints the needed shell commands (either
146.Xr sh 1
147or
148.Xr csh 1
149syntax can be generated) which can be evaluated in the calling shell, eg
150.Cm eval `ssh-agent -s`
151for Bourne-type shells such as
152.Xr sh 1
153or
154.Xr ksh 1
155and
156.Cm eval `ssh-agent -c`
157for
158.Xr csh 1
159and derivatives.
160.Pp
161Later
162.Xr ssh 1
163looks at these variables and uses them to establish a connection to the agent.
164.Pp
165The agent will never send a private key over its request channel.
166Instead, operations that require a private key will be performed
167by the agent, and the result will be returned to the requester.
168This way, private keys are not exposed to clients using the agent.
169.Pp
170A
171.Ux Ns -domain
172socket is created and the name of this socket is stored in the
173.Ev SSH_AUTH_SOCK
174environment
175variable.
176The socket is made accessible only to the current user.
177This method is easily abused by root or another instance of the same
178user.
179.Pp
180The
181.Ev SSH_AGENT_PID
182environment variable holds the agent's process ID.
183.Pp
184The agent exits automatically when the command given on the command
185line terminates.
186.Sh FILES
187.Bl -tag -width Ds
188.It Pa ~/.ssh/identity
189Contains the protocol version 1 RSA authentication identity of the user.
190.It Pa ~/.ssh/id_dsa
191Contains the protocol version 2 DSA authentication identity of the user.
192.It Pa ~/.ssh/id_ecdsa
193Contains the protocol version 2 ECDSA authentication identity of the user.
194.It Pa ~/.ssh/id_ed25519
195Contains the protocol version 2 ED25519 authentication identity of the user.
196.It Pa ~/.ssh/id_rsa
197Contains the protocol version 2 RSA authentication identity of the user.
198.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt
199.Ux Ns -domain
200sockets used to contain the connection to the authentication agent.
201These sockets should only be readable by the owner.
202The sockets should get automatically removed when the agent exits.
203.El
204.Sh SEE ALSO
205.Xr ssh 1 ,
206.Xr ssh-add 1 ,
207.Xr ssh-keygen 1 ,
208.Xr sshd 8
209.Sh AUTHORS
210OpenSSH is a derivative of the original and free
211ssh 1.2.12 release by Tatu Ylonen.
212Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
213Theo de Raadt and Dug Song
214removed many bugs, re-added newer features and
215created OpenSSH.
216Markus Friedl contributed the support for SSH
217protocol versions 1.5 and 2.0.
218