xref: /netbsd-src/crypto/external/bsd/openssh/dist/ssh-agent.1 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: ssh-agent.1,v 1.13 2018/07/10 22:12:08 sevan Exp $
2.\" $OpenBSD: ssh-agent.1,v 1.64 2016/11/30 06:54:26 jmc 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 November 30 2016
40.Dt SSH-AGENT 1
41.Os
42.Sh NAME
43.Nm ssh-agent
44.Nd 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 pkcs11_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
60(RSA, DSA, ECDSA, Ed25519).
61.Nm
62is usually started in the beginning of an X-session or a login session, and
63all other windows or programs are started as clients to the ssh-agent
64program.
65Through use of environment variables the agent can be located
66and automatically used for authentication when logging in to other
67machines using
68.Xr ssh 1 .
69.Pp
70The agent initially does not have any private keys.
71Keys are added using
72.Xr ssh 1
73(see
74.Cm AddKeysToAgent
75in
76.Xr ssh_config 5
77for details)
78or
79.Xr ssh-add 1 .
80Multiple identities may be stored in
81.Nm
82concurrently and
83.Xr ssh 1
84will automatically use them if present.
85.Xr ssh-add 1
86is also used to remove keys from
87.Nm
88and to query the keys that are held in one.
89.Pp
90The options are as follows:
91.Bl -tag -width Ds
92.It Fl a Ar bind_address
93Bind the agent to the
94.Ux Ns -domain
95socket
96.Ar bind_address .
97The default is
98.Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt .
99.It Fl c
100Generate C-shell commands on
101.Dv stdout .
102This is the default if
103.Ev SHELL
104looks like it's a csh style of shell.
105.It Fl D
106Foreground mode.
107When this option is specified
108.Nm
109will not fork.
110.It Fl d
111Debug mode.
112When this option is specified
113.Nm
114will not fork and will write debug information to standard error.
115.It Fl E Ar fingerprint_hash
116Specifies the hash algorithm used when displaying key fingerprints.
117Valid options are:
118.Dq md5
119and
120.Dq sha256 .
121The default is
122.Dq sha256 .
123.It Fl k
124Kill the current agent (given by the
125.Ev SSH_AGENT_PID
126environment variable).
127.It Fl P Ar pkcs11_whitelist
128Specify a pattern-list of acceptable paths for PKCS#11 shared libraries
129that may be added using the
130.Fl s
131option to
132.Xr ssh-add 1 .
133The default is to allow loading PKCS#11 libraries from
134.Dq /usr/lib/*,/usr/pkg/lib/* .
135PKCS#11 libraries that do not match the whitelist will be refused.
136See PATTERNS in
137.Xr ssh_config 5
138for a description of pattern-list syntax.
139.It Fl s
140Generate Bourne shell commands on
141.Dv stdout .
142This is the default if
143.Ev SHELL
144does not look like it's a csh style of shell.
145.It Fl t Ar life
146Set a default value for the maximum lifetime of identities added to the agent.
147The lifetime may be specified in seconds or in a time format specified in
148.Xr sshd_config 5 .
149A lifetime specified for an identity with
150.Xr ssh-add 1
151overrides this value.
152Without this option the default maximum lifetime is forever.
153.El
154.Pp
155If a command line is given, this is executed as a subprocess of the agent.
156When the command dies, so does the agent.
157.Pp
158The idea is that the agent is run in the user's local PC, laptop, or
159terminal.
160Authentication data need not be stored on any other
161machine, and authentication passphrases never go over the network.
162However, the connection to the agent is forwarded over SSH
163remote logins, and the user can thus use the privileges given by the
164identities anywhere in the network in a secure way.
165.Pp
166There are two main ways to get an agent set up:
167The first is that the agent starts a new subcommand into which some environment
168variables are exported, eg
169.Cm ssh-agent xterm & .
170The second is that the agent prints the needed shell commands (either
171.Xr sh 1
172or
173.Xr csh 1
174syntax can be generated) which can be evaluated in the calling shell, eg
175.Cm eval `ssh-agent -s`
176for Bourne-type shells such as
177.Xr sh 1
178or
179.Xr ksh 1
180and
181.Cm eval `ssh-agent -c`
182for
183.Xr csh 1
184and derivatives.
185.Pp
186Later
187.Xr ssh 1
188looks at these variables and uses them to establish a connection to the agent.
189.Pp
190The agent will never send a private key over its request channel.
191Instead, operations that require a private key will be performed
192by the agent, and the result will be returned to the requester.
193This way, private keys are not exposed to clients using the agent.
194.Pp
195A
196.Ux Ns -domain
197socket is created and the name of this socket is stored in the
198.Ev SSH_AUTH_SOCK
199environment
200variable.
201The socket is made accessible only to the current user.
202This method is easily abused by root or another instance of the same
203user.
204.Pp
205The
206.Ev SSH_AGENT_PID
207environment variable holds the agent's process ID.
208.Pp
209The agent exits automatically when the command given on the command
210line terminates.
211.Sh FILES
212.Bl -tag -width Ds
213.It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>
214.Ux Ns -domain
215sockets used to contain the connection to the authentication agent.
216These sockets should only be readable by the owner.
217The sockets should get automatically removed when the agent exits.
218.El
219.Sh SEE ALSO
220.Xr ssh 1 ,
221.Xr ssh-add 1 ,
222.Xr ssh-keygen 1 ,
223.Xr sshd 8
224.Sh AUTHORS
225.An -nosplit
226OpenSSH is a derivative of the original and free ssh 1.2.12 release by
227.An Tatu Ylonen .
228.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt
229and
230.An Dug Song
231removed many bugs, re-added newer features and created OpenSSH.
232.An Markus Friedl
233contributed the support for SSH protocol versions 1.5 and 2.0.
234