6447 handful of nvpair cleanups
[unleashed.git] / usr / src / man / man1 / ssh-keygen.1
blobef8927f664f4651b6acb0e55d414c6b6872556f7
1 '\" te
2 .\" To view license terms, attribution, and copyright for OpenSSH, the default path is /var/sadm/pkg/SUNWsshdr/install/copyright. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the
3 .\" installed location.
4 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
5 .TH SSH-KEYGEN 1 "Feb 17, 2009"
6 .SH NAME
7 ssh-keygen \- authentication key generation
8 .SH SYNOPSIS
9 .LP
10 .nf
11 \fBssh-keygen\fR [\fB-q\fR] [\fB-b\fR \fIbits\fR ] \fB-t\fR \fItype\fR [\fB-N\fR \fInew_passphrase\fR]
12      [\fB-C\fR \fIcomment\fR] [\fB-f\fR \fIoutput_keyfile\fR]
13 .fi
15 .LP
16 .nf
17 \fBssh-keygen\fR \fB-p\fR [\fB-P\fR \fIold_passphrase\fR] [\fB-N\fR \fInew_passphrase\fR]
18      [\fB-f\fR \fIkeyfile\fR]
19 .fi
21 .LP
22 .nf
23 \fBssh-keygen\fR \fB-i\fR [\fB-f\fR \fIinput_keyfile\fR]
24 .fi
26 .LP
27 .nf
28 \fBssh-keygen\fR \fB-e\fR [\fB-f\fR \fIinput_keyfile\fR]
29 .fi
31 .LP
32 .nf
33 \fBssh-keygen\fR \fB-y\fR [\fB-f\fR \fIinput_keyfile\fR]
34 .fi
36 .LP
37 .nf
38 \fBssh-keygen\fR \fB-c\fR [\fB-P\fR \fIpassphrase\fR] [\fB-C\fR \fIcomment\fR] [\fB-f\fR \fIkeyfile\fR]
39 .fi
41 .LP
42 .nf
43 \fBssh-keygen\fR \fB-l\fR [\fB-f\fR \fIinput_keyfile\fR]
44 .fi
46 .LP
47 .nf
48 \fBssh-keygen\fR \fB-B\fR [\fB-f\fR \fIinput_keyfile\fR]
49 .fi
51 .LP
52 .nf
53 \fBssh-keygen\fR \fB-F\fR \fIhostname\fR [\fB-f\fR \fIknown_hosts_file\fR]
54 .fi
56 .LP
57 .nf
58 \fBssh-keygen\fR \fB-H\fR [\fB-f\fR \fIknown_hosts_file\fR]
59 .fi
61 .LP
62 .nf
63 \fBssh-keygen\fR \fB-R\fR \fIhostname\fR [\fB-f\fR \fIknown_hosts_file\fR]
64 .fi
66 .SH DESCRIPTION
67 .sp
68 .LP
69 The \fBssh-keygen\fR utility generates, manages, and converts authentication
70 keys for \fBssh\fR(1). \fBssh-keygen\fR can create RSA keys for use by SSH
71 protocol version 1 and RSA or DSA keys for use by SSH protocol version 2. The
72 type of key to be generated is specified with the \fB-t\fR option.
73 .sp
74 .LP
75 Normally, each user wishing to use \fBSSH\fR with \fBRSA\fR or \fBDSA\fR
76 authentication runs this once to create the authentication key in
77 \fB$HOME/.ssh/identity\fR, \fB$HOME/.ssh/id_dsa\fR, or \fB$HOME/.ssh/id_rsa\fR.
78 The system administrator can also use this to generate host keys..
79 .sp
80 .LP
81 Ordinarily, this program generates the key and asks for a file in which to
82 store the private key. The public key is stored in a file with the same name
83 but with the ``\fB\&.pub\fR'' extension appended. The program also asks for a
84 passphrase. The passphrase can be empty to indicate no passphrase (host keys
85 must have empty passphrases), or it can be a string of arbitrary length. Good
86 passphrases are 10-30 characters long, are not simple sentences or otherwise
87 easy to guess, and contain a mix of uppercase and lowercase letters, numbers,
88 and non-alphanumeric characters. (English prose has only 1-2 bits of entropy
89 per word and provides very poor passphrases.) If a passphrase is set, it must
90 be at least 4 characters long.
91 .sp
92 .LP
93 The passphrase can be changed later by using the \fB-p\fR option.
94 .sp
95 .LP
96 There is no way to recover a lost passphrase. If the passphrase is lost or
97 forgotten, you have to generate a new key and copy the corresponding public key
98 to other machines.
99 .sp
101 For \fBRSA\fR, there is also a comment field in the key file that is only for
102 convenience to the user to help identify the key. The \fIcomment\fR can tell
103 what the key is for, or whatever is useful. The comment is initialized to
104 ``\fBuser@host\fR'' when the key is created, but can be changed using the
105 \fB-c\fR option.
108 After a key is generated, instructions below detail where to place the keys to
109 activate them.
110 .SH OPTIONS
113 The following options are supported:
115 .ne 2
117 \fB\fB-b\fR \fIbits\fR\fR
119 .RS 21n
120 Specifies the number of bits in the key to create. The minimum number is 512
121 bits. Generally, 1024 bits is considered sufficient. Key sizes above that no
122 longer improve security but make things slower. The default is 1024 bits.
126 .ne 2
128 \fB\fB-B\fR\fR
130 .RS 21n
131 Shows the bubblebabble digest of the specified private or public key file.
135 .ne 2
137 \fB\fB-c\fR\fR
139 .RS 21n
140 Requests changing the comment in the private and public key files. The program
141 prompts for the file containing the private keys, for the passphrase if the key
142 has one, and for the new comment.
144 This option only applies to \fBrsa1\fR (\fBSSHv1\fR) keys.
148 .ne 2
150 \fB\fB-C\fR \fIcomment\fR\fR
152 .RS 21n
153 Provides the new comment.
157 .ne 2
159 \fB\fB-e\fR\fR
161 .RS 21n
162 This option reads a private or public OpenSSH key file and prints the key in a
163 "SECSH" Public Key File Format to stdout. This option allows exporting keys for
164 use by several other SSH implementations.
168 .ne 2
170 \fB\fB-f\fR\fR
172 .RS 21n
173 Specifies the filename of the key file.
177 .ne 2
179 \fB\fB-F\fR\fR
181 .RS 21n
182 Search for the specified \fIhostname\fR in a \fBknown_hosts\fR file, listing
183 any occurrences found. This option is useful to find hashed host names or
184 addresses and can also be used in conjunction with the \fB-H\fR option to print
185 found keys in a hashed format.
189 .ne 2
191 \fB\fB-H\fR\fR
193 .RS 21n
194 Hash a \fBknown_hosts\fR file. This replaces all host names and addresses with
195 hashed representations within the specified file. The original content is moved
196 to a file with a \fB\&.old\fR suffix. These hashes may be used normally by
197 \fBssh\fR and \fBsshd\fR, but they do not reveal identifying information should
198 the file's contents be disclosed. This option does not modify existing hashed
199 host names and is therefore safe to use on files that mix hashed and non-hashed
200 names.
204 .ne 2
206 \fB\fB-i\fR\fR
208 .RS 21n
209 This option reads an unencrypted private (or public) key file in
210 SSH2-compatible format and prints an OpenSSH compatible private (or public) key
211 to stdout. \fBssh-keygen\fR also reads the "SECSH" Public Key File Format. This
212 option allows importing keys from several other SSH implementations.
216 .ne 2
218 \fB\fB-l\fR\fR
220 .RS 21n
221 Shows the fingerprint of the specified private or public key file.
225 .ne 2
227 \fB\fB-N\fR \fInew_passphrase\fR\fR
229 .RS 21n
230 Provides the new passphrase.
234 .ne 2
236 \fB\fB-p\fR\fR
238 .RS 21n
239 Requests changing the passphrase of a private key file instead of creating a
240 new private key. The program prompts for the file containing the private key,
241 for the old passphrase, and prompts twice for the new passphrase.
245 .ne 2
247 \fB\fB-P\fR \fIpassphrase\fR\fR
249 .RS 21n
250 Provides the (old) passphrase.
254 .ne 2
256 \fB\fB-q\fR\fR
258 .RS 21n
259 Silences \fBssh-keygen\fR.
263 .ne 2
265 \fB\fB-t\fR \fItype\fR\fR
267 .RS 21n
268 Specifies the algorithm used for the key, where \fItype\fR is one of \fBrsa\fR,
269 \fBdsa\fR, and \fBrsa1\fR. Type \fBrsa1\fR is used only for the SSHv1 protocol.
273 .ne 2
275 \fB\fB-R\fR \fIhostname\fR\fR
277 .RS 21n
278 Removes all keys belonging to \fIhostname\fR from a \fBknown_hosts\fR file.
279 This option is useful to delete hashed hosts. See \fB-H\fR.
283 .ne 2
285 \fB\fB-x\fR\fR
287 .RS 21n
288 Obsolete. Replaced by the \fB-e\fR option.
292 .ne 2
294 \fB\fB-X\fR\fR
296 .RS 21n
297 Obsolete. Replaced by the \fB-i\fR option.
301 .ne 2
303 \fB\fB-y\fR\fR
305 .RS 21n
306 This option reads a private OpenSSH format file and prints an OpenSSH public
307 key to stdout.
310 .SH EXIT STATUS
313 The following exit values are returned:
315 .ne 2
317 \fB\fB0\fR\fR
319 .RS 5n
320 Successful completion.
324 .ne 2
326 \fB\fB1\fR\fR
328 .RS 5n
329 An error occurred.
332 .SH FILES
334 .ne 2
336 \fB\fB$HOME/.ssh/identity\fR\fR
338 .RS 27n
339 This file contains the RSA private key for the SSHv1 protocol. This file should
340 not be readable by anyone but the user. It is possible to specify a passphrase
341 when generating the key; that passphrase is used to encrypt the private part of
342 this file using 3DES. This file is not automatically accessed by
343 \fBssh-keygen\fR, but it is offered as the default file for the private key.
344 \fBsshd\fR(1M) reads this file when a login attempt is made.
348 .ne 2
350 \fB\fB$HOME/.ssh/identity.pub\fR\fR
352 .RS 27n
353 This file contains the RSA public key for the SSHv1 protocol. The contents of
354 this file should be added to \fB$HOME/.ssh/authorized_keys\fR on all machines
355 where you wish to log in using \fBRSA\fR authentication. There is no need to
356 keep the contents of this file secret.
360 .ne 2
362 \fB\fB$HOME/.ssh/id_dsa\fR\fR
366 \fB\fB$HOME/.ssh/id_rsa\fR\fR
368 .RS 27n
369 These files contain, respectively, the DSA or RSA private key for the SSHv2
370 protocol. These files should not be readable by anyone but the user. It is
371 possible to specify a passphrase when generating the key; that passphrase is
372 used to encrypt the private part of the file using 3DES. Neither of these files
373 is automatically accessed by \fBssh-keygen\fR but is offered as the default
374 file for the private key. \fBsshd\fR(1M) reads this file when a login attempt
375 is made.
379 .ne 2
381 \fB\fB$HOME/.ssh/id_dsa.pub\fR\fR
385 \fB\fB$HOME/.ssh/id_rsa.pub\fR\fR
387 .RS 27n
388 These files contain, respectively, the DSA or RSA public key for the SSHv2
389 protocol. The contents of these files should be added, respectively, to
390 \fB$HOME/.ssh/authorized_keys\fR on all machines where you wish to log in using
391 DSA or RSA authentication. There is no need to keep the contents of these files
392 secret.
395 .SH ATTRIBUTES
398 See \fBattributes\fR(5) for descriptions of the following attributes:
403 box;
404 c | c
405 l | l .
406 ATTRIBUTE TYPE  ATTRIBUTE VALUE
408 Interface Stability     Committed
411 .SH SEE ALSO
414 \fBssh\fR(1), \fBssh-add\fR(1), \fBssh-agent\fR(1), \fBsshd\fR(1M),
415 \fBattributes\fR(5)