xref: /netbsd-src/crypto/external/bsd/openssh/dist/ssh-add.1 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: ssh-add.1,v 1.13 2017/10/07 19:39:19 christos Exp $
2.\"	$OpenBSD: ssh-add.1,v 1.66 2017/08/29 13:05:58 jmc 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 August 29 2017
40.Dt SSH-ADD 1
41.Os
42.Sh NAME
43.Nm ssh-add
44.Nd adds private key identities to the authentication agent
45.Sh SYNOPSIS
46.Nm ssh-add
47.Op Fl cDdkLlqXx
48.Op Fl E Ar fingerprint_hash
49.Op Fl t Ar life
50.Op Ar
51.Nm ssh-add
52.Fl s Ar pkcs11
53.Nm ssh-add
54.Fl e Ar pkcs11
55.Sh DESCRIPTION
56.Nm
57adds private key identities to the authentication agent,
58.Xr ssh-agent 1 .
59When run without arguments, it adds the files
60.Pa ~/.ssh/id_rsa ,
61.Pa ~/.ssh/id_dsa ,
62.Pa ~/.ssh/id_ecdsa ,
63and
64.Pa ~/.ssh/id_ed25519 .
65After loading a private key,
66.Nm
67will try to load corresponding certificate information from the
68filename obtained by appending
69.Pa -cert.pub
70to the name of the private key file.
71Alternative file names can be given on the command line.
72.Pp
73If any file requires a passphrase,
74.Nm
75asks for the passphrase from the user.
76The passphrase is read from the user's tty.
77.Nm
78retries the last passphrase if multiple identity files are given.
79.Pp
80The authentication agent must be running and the
81.Ev SSH_AUTH_SOCK
82environment variable must contain the name of its socket for
83.Nm
84to work.
85.Pp
86The options are as follows:
87.Bl -tag -width Ds
88.It Fl c
89Indicates that added identities should be subject to confirmation before
90being used for authentication.
91Confirmation is performed by
92.Xr ssh-askpass 1 .
93Successful confirmation is signaled by a zero exit status from
94.Xr ssh-askpass 1 ,
95rather than text entered into the requester.
96.It Fl D
97Deletes all identities from the agent.
98.It Fl d
99Instead of adding identities, removes identities from the agent.
100If
101.Nm
102has been run without arguments, the keys for the default identities and
103their corresponding certificates will be removed.
104Otherwise, the argument list will be interpreted as a list of paths to
105public key files to specify keys and certificates to be removed from the agent.
106If no public key is found at a given path,
107.Nm
108will append
109.Pa .pub
110and retry.
111.It Fl E Ar fingerprint_hash
112Specifies the hash algorithm used when displaying key fingerprints.
113Valid options are:
114.Dq md5
115and
116.Dq sha256 .
117The default is
118.Dq sha256 .
119.It Fl e Ar pkcs11
120Remove keys provided by the PKCS#11 shared library
121.Ar pkcs11 .
122.It Fl k
123When loading keys into or deleting keys from the agent, process plain private
124keys only and skip certificates.
125.It Fl L
126Lists public key parameters of all identities currently represented
127by the agent.
128.It Fl l
129Lists fingerprints of all identities currently represented by the agent.
130.It Fl q
131Be quiet after a successful operation.
132.It Fl s Ar pkcs11
133Add keys provided by the PKCS#11 shared library
134.Ar pkcs11 .
135.It Fl t Ar life
136Set a maximum lifetime when adding identities to an agent.
137The lifetime may be specified in seconds or in a time format
138specified in
139.Xr sshd_config 5 .
140.It Fl X
141Unlock the agent.
142.It Fl x
143Lock the agent with a password.
144.El
145.Sh ENVIRONMENT
146.Bl -tag -width Ds
147.It Ev "DISPLAY" and "SSH_ASKPASS"
148If
149.Nm
150needs a passphrase, it will read the passphrase from the current
151terminal if it was run from a terminal.
152If
153.Nm
154does not have a terminal associated with it but
155.Ev DISPLAY
156and
157.Ev SSH_ASKPASS
158are set, it will execute the program specified by
159.Ev SSH_ASKPASS
160(by default
161.Dq ssh-askpass )
162and open an X11 window to read the passphrase.
163This is particularly useful when calling
164.Nm
165from a
166.Pa .xsession
167or related script.
168(Note that on some machines it
169may be necessary to redirect the input from
170.Pa /dev/null
171to make this work.)
172.It Ev SSH_AUTH_SOCK
173Identifies the path of a
174.Ux Ns -domain
175socket used to communicate with the agent.
176.El
177.Sh FILES
178.Bl -tag -width Ds
179.It Pa ~/.ssh/id_dsa
180Contains the DSA authentication identity of the user.
181.It Pa ~/.ssh/id_ecdsa
182Contains the ECDSA authentication identity of the user.
183.It Pa ~/.ssh/id_ed25519
184Contains the Ed25519 authentication identity of the user.
185.It Pa ~/.ssh/id_rsa
186Contains the RSA authentication identity of the user.
187.El
188.Pp
189Identity files should not be readable by anyone but the user.
190Note that
191.Nm
192ignores identity files if they are accessible by others.
193.Sh EXIT STATUS
194Exit status is 0 on success, 1 if the specified command fails,
195and 2 if
196.Nm
197is unable to contact the authentication agent.
198.Sh SEE ALSO
199.Xr ssh 1 ,
200.Xr ssh-agent 1 ,
201.Xr ssh-askpass 1 ,
202.Xr ssh-keygen 1 ,
203.Xr sshd 8
204.Sh AUTHORS
205OpenSSH is a derivative of the original and free
206ssh 1.2.12 release by Tatu Ylonen.
207Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
208Theo de Raadt and Dug Song
209removed many bugs, re-added newer features and
210created OpenSSH.
211Markus Friedl contributed the support for SSH
212protocol versions 1.5 and 2.0.
213