xref: /netbsd-src/crypto/external/bsd/openssh/dist/ssh-add.1 (revision 82d56013d7b633d116a93943de88e08335357a7c)
1.\"	$NetBSD: ssh-add.1,v 1.16 2020/12/04 18:42:50 christos Exp $
2.\"	$OpenBSD: ssh-add.1,v 1.81 2020/07/14 23:57:01 djm Exp $
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.\"
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 July 14 2020
40.Dt SSH-ADD 1
41.Os
42.Sh NAME
43.Nm ssh-add
44.Nd adds private key identities to the OpenSSH authentication agent
45.Sh SYNOPSIS
46.Nm ssh-add
47.Op Fl cDdKkLlqvXx
48.Op Fl E Ar fingerprint_hash
49.Op Fl S Ar provider
50.Op Fl t Ar life
51.Op Ar
52.Nm ssh-add
53.Fl s Ar pkcs11
54.Nm ssh-add
55.Fl e Ar pkcs11
56.Nm ssh-add
57.Fl T
58.Ar pubkey ...
59.Sh DESCRIPTION
60.Nm
61adds private key identities to the authentication agent,
62.Xr ssh-agent 1 .
63When run without arguments, it adds the files
64.Pa ~/.ssh/id_rsa ,
65.Pa ~/.ssh/id_dsa ,
66.Pa ~/.ssh/id_ecdsa ,
67.Pa ~/.ssh/id_ecdsa_sk ,
68.Pa ~/.ssh/id_ed25519 ,
69and
70.Pa ~/.ssh/id_ed25519_sk .
71After loading a private key,
72.Nm
73will try to load corresponding certificate information from the
74filename obtained by appending
75.Pa -cert.pub
76to the name of the private key file.
77Alternative file names can be given on the command line.
78.Pp
79If any file requires a passphrase,
80.Nm
81asks for the passphrase from the user.
82The passphrase is read from the user's tty.
83.Nm
84retries the last passphrase if multiple identity files are given.
85.Pp
86The authentication agent must be running and the
87.Ev SSH_AUTH_SOCK
88environment variable must contain the name of its socket for
89.Nm
90to work.
91.Pp
92The options are as follows:
93.Bl -tag -width Ds
94.It Fl c
95Indicates that added identities should be subject to confirmation before
96being used for authentication.
97Confirmation is performed by
98.Xr ssh-askpass 1 .
99Successful confirmation is signaled by a zero exit status from
100.Xr ssh-askpass 1 ,
101rather than text entered into the requester.
102.It Fl D
103Deletes all identities from the agent.
104.It Fl d
105Instead of adding identities, removes identities from the agent.
106If
107.Nm
108has been run without arguments, the keys for the default identities and
109their corresponding certificates will be removed.
110Otherwise, the argument list will be interpreted as a list of paths to
111public key files to specify keys and certificates to be removed from the agent.
112If no public key is found at a given path,
113.Nm
114will append
115.Pa .pub
116and retry.
117If the argument list consists of
118.Dq -
119then
120.Nm
121will read public keys to be removed from standard input.
122.It Fl E Ar fingerprint_hash
123Specifies the hash algorithm used when displaying key fingerprints.
124Valid options are:
125.Dq md5
126and
127.Dq sha256 .
128The default is
129.Dq sha256 .
130.It Fl e Ar pkcs11
131Remove keys provided by the PKCS#11 shared library
132.Ar pkcs11 .
133.It Fl K
134Load resident keys from a FIDO authenticator.
135.It Fl k
136When loading keys into or deleting keys from the agent, process plain private
137keys only and skip certificates.
138.It Fl L
139Lists public key parameters of all identities currently represented
140by the agent.
141.It Fl l
142Lists fingerprints of all identities currently represented by the agent.
143.It Fl q
144Be quiet after a successful operation.
145.It Fl S Ar provider
146Specifies a path to a library that will be used when adding
147FIDO authenticator-hosted keys, overriding the default of using the
148internal USB HID support.
149.It Fl s Ar pkcs11
150Add keys provided by the PKCS#11 shared library
151.Ar pkcs11 .
152.It Fl T Ar pubkey ...
153Tests whether the private keys that correspond to the specified
154.Ar pubkey
155files are usable by performing sign and verify operations on each.
156.It Fl t Ar life
157Set a maximum lifetime when adding identities to an agent.
158The lifetime may be specified in seconds or in a time format
159specified in
160.Xr sshd_config 5 .
161.It Fl v
162Verbose mode.
163Causes
164.Nm
165to print debugging messages about its progress.
166This is helpful in debugging problems.
167Multiple
168.Fl v
169options increase the verbosity.
170The maximum is 3.
171.It Fl X
172Unlock the agent.
173.It Fl x
174Lock the agent with a password.
175.El
176.Sh ENVIRONMENT
177.Bl -tag -width Ds
178.It Ev "DISPLAY", "SSH_ASKPASS" and "SSH_ASKPASS_REQUIRE"
179If
180.Nm
181needs a passphrase, it will read the passphrase from the current
182terminal if it was run from a terminal.
183If
184.Nm
185does not have a terminal associated with it but
186.Ev DISPLAY
187and
188.Ev SSH_ASKPASS
189are set, it will execute the program specified by
190.Ev SSH_ASKPASS
191(by default
192.Dq ssh-askpass )
193and open an X11 window to read the passphrase.
194This is particularly useful when calling
195.Nm
196from a
197.Pa .xsession
198or related script.
199.Pp
200.Ev SSH_ASKPASS_REQUIRE
201allows further control over the use of an askpass program.
202If this variable is set to
203.Dq never
204then
205.Nm
206will never attempt to use one.
207If it is set to
208.Dq prefer ,
209then
210.Nm
211will prefer to use the askpass program instead of the TTY when requesting
212passwords.
213Finally, if the variable is set to
214.Dq force ,
215then the askpass program will be used for all passphrase input regardless
216of whether
217.Ev DISPLAY
218is set.
219.It Ev SSH_AUTH_SOCK
220Identifies the path of a
221.Ux Ns -domain
222socket used to communicate with the agent.
223.It Ev SSH_SK_PROVIDER
224Specifies a path to a library that will be used when loading any
225FIDO authenticator-hosted keys, overriding the default of using
226the built-in USB HID support.
227.El
228.Sh FILES
229.Bl -tag -width Ds -compact
230.It Pa ~/.ssh/id_dsa
231.It Pa ~/.ssh/id_ecdsa
232.It Pa ~/.ssh/id_ecdsa_sk
233.It Pa ~/.ssh/id_ed25519
234.It Pa ~/.ssh/id_ed25519_sk
235.It Pa ~/.ssh/id_rsa
236Contains the DSA, ECDSA, authenticator-hosted ECDSA, Ed25519,
237authenticator-hosted Ed25519 or RSA authentication identity of the user.
238.El
239.Pp
240Identity files should not be readable by anyone but the user.
241Note that
242.Nm
243ignores identity files if they are accessible by others.
244.Sh EXIT STATUS
245Exit status is 0 on success, 1 if the specified command fails,
246and 2 if
247.Nm
248is unable to contact the authentication agent.
249.Sh SEE ALSO
250.Xr ssh 1 ,
251.Xr ssh-agent 1 ,
252.Xr ssh-askpass 1 ,
253.Xr ssh-keygen 1 ,
254.Xr sshd 8
255.Sh AUTHORS
256OpenSSH is a derivative of the original and free
257ssh 1.2.12 release by Tatu Ylonen.
258Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
259Theo de Raadt and Dug Song
260removed many bugs, re-added newer features and
261created OpenSSH.
262Markus Friedl contributed the support for SSH
263protocol versions 1.5 and 2.0.
264