1SSH-ADD(1) BSD General Commands Manual SSH-ADD(1)
2
4 ssh-add — adds private key identities to the OpenSSH authentication agent
5
7 ssh-add [-cDdKkLlqvXx] [-E fingerprint_hash] [-S provider] [-t life]
8 [file ...]
9 ssh-add -s pkcs11
10 ssh-add -e pkcs11
11 ssh-add -T pubkey ...
12
14 ssh-add adds private key identities to the authentication agent,
15 ssh-agent(1). When run without arguments, it adds the files
16 ~/.ssh/id_rsa, ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ecdsa_sk,
17 ~/.ssh/id_ed25519, and ~/.ssh/id_ed25519_sk. After loading a private
18 key, ssh-add will try to load corresponding certificate information from
19 the filename obtained by appending -cert.pub to the name of the private
20 key file. Alternative file names can be given on the command line.
21
22 If any file requires a passphrase, ssh-add asks for the passphrase from
23 the user. The passphrase is read from the user's tty. ssh-add retries
24 the last passphrase if multiple identity files are given.
25
26 The authentication agent must be running and the SSH_AUTH_SOCK environ‐
27 ment variable must contain the name of its socket for ssh-add to work.
28
29 The options are as follows:
30
31 -c Indicates that added identities should be subject to confirmation
32 before being used for authentication. Confirmation is performed
33 by ssh-askpass(1). Successful confirmation is signaled by a zero
34 exit status from ssh-askpass(1), rather than text entered into
35 the requester.
36
37 -D Deletes all identities from the agent.
38
39 -d Instead of adding identities, removes identities from the agent.
40 If ssh-add has been run without arguments, the keys for the
41 default identities and their corresponding certificates will be
42 removed. Otherwise, the argument list will be interpreted as a
43 list of paths to public key files to specify keys and certifi‐
44 cates to be removed from the agent. If no public key is found at
45 a given path, ssh-add will append .pub and retry. If the argu‐
46 ment list consists of “-” then ssh-add will read public keys to
47 be removed from standard input.
48
49 -E fingerprint_hash
50 Specifies the hash algorithm used when displaying key finger‐
51 prints. Valid options are: “md5” and “sha256”. The default is
52 “sha256”.
53
54 -e pkcs11
55 Remove keys provided by the PKCS#11 shared library pkcs11.
56
57 -K Load resident keys from a FIDO authenticator.
58
59 -k When loading keys into or deleting keys from the agent, process
60 plain private keys only and skip certificates.
61
62 -L Lists public key parameters of all identities currently repre‐
63 sented by the agent.
64
65 -l Lists fingerprints of all identities currently represented by the
66 agent.
67
68 -q Be quiet after a successful operation.
69
70 -S provider
71 Specifies a path to a library that will be used when adding FIDO
72 authenticator-hosted keys, overriding the default of using the
73 internal USB HID support.
74
75 -s pkcs11
76 Add keys provided by the PKCS#11 shared library pkcs11.
77
78 -T pubkey ...
79 Tests whether the private keys that correspond to the specified
80 pubkey files are usable by performing sign and verify operations
81 on each.
82
83 -t life
84 Set a maximum lifetime when adding identities to an agent. The
85 lifetime may be specified in seconds or in a time format speci‐
86 fied in sshd_config(5).
87
88 -v Verbose mode. Causes ssh-add to print debugging messages about
89 its progress. This is helpful in debugging problems. Multiple
90 -v options increase the verbosity. The maximum is 3.
91
92 -X Unlock the agent.
93
94 -x Lock the agent with a password.
95
97 DISPLAY, SSH_ASKPASS and SSH_ASKPASS_REQUIRE
98 If ssh-add needs a passphrase, it will read the passphrase from
99 the current terminal if it was run from a terminal. If ssh-add
100 does not have a terminal associated with it but DISPLAY and
101 SSH_ASKPASS are set, it will execute the program specified by
102 SSH_ASKPASS (by default “ssh-askpass”) and open an X11 window to
103 read the passphrase. This is particularly useful when calling
104 ssh-add from a .xsession or related script.
105
106 SSH_ASKPASS_REQUIRE allows further control over the use of an
107 askpass program. If this variable is set to “never” then ssh-add
108 will never attempt to use one. If it is set to “prefer”, then
109 ssh-add will prefer to use the askpass program instead of the TTY
110 when requesting passwords. Finally, if the variable is set to
111 “force”, then the askpass program will be used for all passphrase
112 input regardless of whether DISPLAY is set.
113
114 SSH_AUTH_SOCK
115 Identifies the path of a UNIX-domain socket used to communicate
116 with the agent.
117
118 SSH_SK_PROVIDER
119 Specifies a path to a library that will be used when loading any
120 FIDO authenticator-hosted keys, overriding the default of using
121 the built-in USB HID support.
122
124 ~/.ssh/id_dsa
125 ~/.ssh/id_ecdsa
126 ~/.ssh/id_ecdsa_sk
127 ~/.ssh/id_ed25519
128 ~/.ssh/id_ed25519_sk
129 ~/.ssh/id_rsa
130 Contains the DSA, ECDSA, authenticator-hosted ECDSA, Ed25519,
131 authenticator-hosted Ed25519 or RSA authentication identity of
132 the user.
133
134 Identity files should not be readable by anyone but the user. Note that
135 ssh-add ignores identity files if they are accessible by others.
136
138 Exit status is 0 on success, 1 if the specified command fails, and 2 if
139 ssh-add is unable to contact the authentication agent.
140
142 ssh(1), ssh-agent(1), ssh-askpass(1), ssh-keygen(1), sshd(8)
143
145 OpenSSH is a derivative of the original and free ssh 1.2.12 release by
146 Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo
147 de Raadt and Dug Song removed many bugs, re-added newer features and cre‐
148 ated OpenSSH. Markus Friedl contributed the support for SSH protocol
149 versions 1.5 and 2.0.
150
151BSD July 14, 2020 BSD