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
  14 
  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
  20 
  21 .LP
  22 .nf
  23 \fBssh-keygen\fR \fB-i\fR [\fB-f\fR \fIinput_keyfile\fR]
  24 .fi
  25 
  26 .LP
  27 .nf
  28 \fBssh-keygen\fR \fB-e\fR [\fB-f\fR \fIinput_keyfile\fR]
  29 .fi
  30 
  31 .LP
  32 .nf
  33 \fBssh-keygen\fR \fB-y\fR [\fB-f\fR \fIinput_keyfile\fR]
  34 .fi
  35 
  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
  40 
  41 .LP
  42 .nf
  43 \fBssh-keygen\fR \fB-l\fR [\fB-f\fR \fIinput_keyfile\fR]
  44 .fi
  45 
  46 .LP
  47 .nf
  48 \fBssh-keygen\fR \fB-B\fR [\fB-f\fR \fIinput_keyfile\fR]
  49 .fi
  50 
  51 .LP
  52 .nf
  53 \fBssh-keygen\fR \fB-F\fR \fIhostname\fR [\fB-f\fR \fIknown_hosts_file\fR]
  54 .fi
  55 
  56 .LP
  57 .nf
  58 \fBssh-keygen\fR \fB-H\fR [\fB-f\fR \fIknown_hosts_file\fR]
  59 .fi
  60 
  61 .LP
  62 .nf
  63 \fBssh-keygen\fR \fB-R\fR \fIhostname\fR [\fB-f\fR \fIknown_hosts_file\fR]
  64 .fi
  65 
  66 .SH DESCRIPTION
  67 .LP
  68 The \fBssh-keygen\fR utility generates, manages, and converts authentication
  69 keys for \fBssh\fR(1). \fBssh-keygen\fR can create RSA keys for use by SSH
  70 protocol version 1 and RSA or DSA keys for use by SSH protocol version 2. The
  71 type of key to be generated is specified with the \fB-t\fR option.
  72 .sp
  73 .LP
  74 Normally, each user wishing to use \fBSSH\fR with \fBRSA\fR or \fBDSA\fR
  75 authentication runs this once to create the authentication key in
  76 \fB$HOME/.ssh/identity\fR, \fB$HOME/.ssh/id_dsa\fR, or \fB$HOME/.ssh/id_rsa\fR.
  77 The system administrator can also use this to generate host keys..
  78 .sp
  79 .LP
  80 Ordinarily, this program generates the key and asks for a file in which to
  81 store the private key. The public key is stored in a file with the same name
  82 but with the ``\fB\&.pub\fR'' extension appended. The program also asks for a
  83 passphrase. The passphrase can be empty to indicate no passphrase (host keys
  84 must have empty passphrases), or it can be a string of arbitrary length. Good
  85 passphrases are 10-30 characters long, are not simple sentences or otherwise
  86 easy to guess, and contain a mix of uppercase and lowercase letters, numbers,
  87 and non-alphanumeric characters. (English prose has only 1-2 bits of entropy
  88 per word and provides very poor passphrases.) If a passphrase is set, it must
  89 be at least 4 characters long.
  90 .sp
  91 .LP
  92 The passphrase can be changed later by using the \fB-p\fR option.
  93 .sp
  94 .LP
  95 There is no way to recover a lost passphrase. If the passphrase is lost or
  96 forgotten, you have to generate a new key and copy the corresponding public key
  97 to other machines.
  98 .sp
  99 .LP
 100 For \fBRSA\fR, there is also a comment field in the key file that is only for
 101 convenience to the user to help identify the key. The \fIcomment\fR can tell
 102 what the key is for, or whatever is useful. The comment is initialized to
 103 ``\fBuser@host\fR'' when the key is created, but can be changed using the
 104 \fB-c\fR option.
 105 .sp
 106 .LP
 107 After a key is generated, instructions below detail where to place the keys to
 108 activate them.
 109 .SH OPTIONS
 110 .LP
 111 The following options are supported:
 112 .sp
 113 .ne 2
 114 .na
 115 \fB\fB-b\fR \fIbits\fR\fR
 116 .ad
 117 .RS 21n
 118 Specifies the number of bits in the key to create. The minimum number is 512
 119 bits. Generally, 1024 bits is considered sufficient. Key sizes above that no
 120 longer improve security but make things slower. The default is 1024 bits.
 121 .RE
 122 
 123 .sp
 124 .ne 2
 125 .na
 126 \fB\fB-B\fR\fR
 127 .ad
 128 .RS 21n
 129 Shows the bubblebabble digest of the specified private or public key file.
 130 .RE
 131 
 132 .sp
 133 .ne 2
 134 .na
 135 \fB\fB-c\fR\fR
 136 .ad
 137 .RS 21n
 138 Requests changing the comment in the private and public key files. The program
 139 prompts for the file containing the private keys, for the passphrase if the key
 140 has one, and for the new comment.
 141 .sp
 142 This option only applies to \fBrsa1\fR (\fBSSHv1\fR) keys.
 143 .RE
 144 
 145 .sp
 146 .ne 2
 147 .na
 148 \fB\fB-C\fR \fIcomment\fR\fR
 149 .ad
 150 .RS 21n
 151 Provides the new comment.
 152 .RE
 153 
 154 .sp
 155 .ne 2
 156 .na
 157 \fB\fB-e\fR\fR
 158 .ad
 159 .RS 21n
 160 This option reads a private or public OpenSSH key file and prints the key in a
 161 "SECSH" Public Key File Format to stdout. This option allows exporting keys for
 162 use by several other SSH implementations.
 163 .RE
 164 
 165 .sp
 166 .ne 2
 167 .na
 168 \fB\fB-f\fR\fR
 169 .ad
 170 .RS 21n
 171 Specifies the filename of the key file.
 172 .RE
 173 
 174 .sp
 175 .ne 2
 176 .na
 177 \fB\fB-F\fR\fR
 178 .ad
 179 .RS 21n
 180 Search for the specified \fIhostname\fR in a \fBknown_hosts\fR file, listing
 181 any occurrences found. This option is useful to find hashed host names or
 182 addresses and can also be used in conjunction with the \fB-H\fR option to print
 183 found keys in a hashed format.
 184 .RE
 185 
 186 .sp
 187 .ne 2
 188 .na
 189 \fB\fB-H\fR\fR
 190 .ad
 191 .RS 21n
 192 Hash a \fBknown_hosts\fR file. This replaces all host names and addresses with
 193 hashed representations within the specified file. The original content is moved
 194 to a file with a \fB\&.old\fR suffix. These hashes may be used normally by
 195 \fBssh\fR and \fBsshd\fR, but they do not reveal identifying information should
 196 the file's contents be disclosed. This option does not modify existing hashed
 197 host names and is therefore safe to use on files that mix hashed and non-hashed
 198 names.
 199 .RE
 200 
 201 .sp
 202 .ne 2
 203 .na
 204 \fB\fB-i\fR\fR
 205 .ad
 206 .RS 21n
 207 This option reads an unencrypted private (or public) key file in
 208 SSH2-compatible format and prints an OpenSSH compatible private (or public) key
 209 to stdout. \fBssh-keygen\fR also reads the "SECSH" Public Key File Format. This
 210 option allows importing keys from several other SSH implementations.
 211 .RE
 212 
 213 .sp
 214 .ne 2
 215 .na
 216 \fB\fB-l\fR\fR
 217 .ad
 218 .RS 21n
 219 Shows the fingerprint of the specified private or public key file.
 220 .RE
 221 
 222 .sp
 223 .ne 2
 224 .na
 225 \fB\fB-N\fR \fInew_passphrase\fR\fR
 226 .ad
 227 .RS 21n
 228 Provides the new passphrase.
 229 .RE
 230 
 231 .sp
 232 .ne 2
 233 .na
 234 \fB\fB-p\fR\fR
 235 .ad
 236 .RS 21n
 237 Requests changing the passphrase of a private key file instead of creating a
 238 new private key. The program prompts for the file containing the private key,
 239 for the old passphrase, and prompts twice for the new passphrase.
 240 .RE
 241 
 242 .sp
 243 .ne 2
 244 .na
 245 \fB\fB-P\fR \fIpassphrase\fR\fR
 246 .ad
 247 .RS 21n
 248 Provides the (old) passphrase.
 249 .RE
 250 
 251 .sp
 252 .ne 2
 253 .na
 254 \fB\fB-q\fR\fR
 255 .ad
 256 .RS 21n
 257 Silences \fBssh-keygen\fR.
 258 .RE
 259 
 260 .sp
 261 .ne 2
 262 .na
 263 \fB\fB-t\fR \fItype\fR\fR
 264 .ad
 265 .RS 21n
 266 Specifies the algorithm used for the key, where \fItype\fR is one of \fBrsa\fR,
 267 \fBdsa\fR, and \fBrsa1\fR. Type \fBrsa1\fR is used only for the SSHv1 protocol.
 268 .RE
 269 
 270 .sp
 271 .ne 2
 272 .na
 273 \fB\fB-R\fR \fIhostname\fR\fR
 274 .ad
 275 .RS 21n
 276 Removes all keys belonging to \fIhostname\fR from a \fBknown_hosts\fR file.
 277 This option is useful to delete hashed hosts. See \fB-H\fR.
 278 .RE
 279 
 280 .sp
 281 .ne 2
 282 .na
 283 \fB\fB-x\fR\fR
 284 .ad
 285 .RS 21n
 286 Obsolete. Replaced by the \fB-e\fR option.
 287 .RE
 288 
 289 .sp
 290 .ne 2
 291 .na
 292 \fB\fB-X\fR\fR
 293 .ad
 294 .RS 21n
 295 Obsolete. Replaced by the \fB-i\fR option.
 296 .RE
 297 
 298 .sp
 299 .ne 2
 300 .na
 301 \fB\fB-y\fR\fR
 302 .ad
 303 .RS 21n
 304 This option reads a private OpenSSH format file and prints an OpenSSH public
 305 key to stdout.
 306 .RE
 307 
 308 .SH EXIT STATUS
 309 .LP
 310 The following exit values are returned:
 311 .sp
 312 .ne 2
 313 .na
 314 \fB\fB0\fR\fR
 315 .ad
 316 .RS 5n
 317 Successful completion.
 318 .RE
 319 
 320 .sp
 321 .ne 2
 322 .na
 323 \fB\fB1\fR\fR
 324 .ad
 325 .RS 5n
 326 An error occurred.
 327 .RE
 328 
 329 .SH FILES
 330 .ne 2
 331 .na
 332 \fB\fB$HOME/.ssh/identity\fR\fR
 333 .ad
 334 .RS 27n
 335 This file contains the RSA private key for the SSHv1 protocol. This file should
 336 not be readable by anyone but the user. It is possible to specify a passphrase
 337 when generating the key; that passphrase is used to encrypt the private part of
 338 this file using 3DES. This file is not automatically accessed by
 339 \fBssh-keygen\fR, but it is offered as the default file for the private key.
 340 \fBsshd\fR(1M) reads this file when a login attempt is made.
 341 .RE
 342 
 343 .sp
 344 .ne 2
 345 .na
 346 \fB\fB$HOME/.ssh/identity.pub\fR\fR
 347 .ad
 348 .RS 27n
 349 This file contains the RSA public key for the SSHv1 protocol. The contents of
 350 this file should be added to \fB$HOME/.ssh/authorized_keys\fR on all machines
 351 where you wish to log in using \fBRSA\fR authentication. There is no need to
 352 keep the contents of this file secret.
 353 .RE
 354 
 355 .sp
 356 .ne 2
 357 .na
 358 \fB\fB$HOME/.ssh/id_dsa\fR\fR
 359 .ad
 360 .br
 361 .na
 362 \fB\fB$HOME/.ssh/id_rsa\fR\fR
 363 .ad
 364 .RS 27n
 365 These files contain, respectively, the DSA or RSA private key for the SSHv2
 366 protocol. These files should not be readable by anyone but the user. It is
 367 possible to specify a passphrase when generating the key; that passphrase is
 368 used to encrypt the private part of the file using 3DES. Neither of these files
 369 is automatically accessed by \fBssh-keygen\fR but is offered as the default
 370 file for the private key. \fBsshd\fR(1M) reads this file when a login attempt
 371 is made.
 372 .RE
 373 
 374 .sp
 375 .ne 2
 376 .na
 377 \fB\fB$HOME/.ssh/id_dsa.pub\fR\fR
 378 .ad
 379 .br
 380 .na
 381 \fB\fB$HOME/.ssh/id_rsa.pub\fR\fR
 382 .ad
 383 .RS 27n
 384 These files contain, respectively, the DSA or RSA public key for the SSHv2
 385 protocol. The contents of these files should be added, respectively, to
 386 \fB$HOME/.ssh/authorized_keys\fR on all machines where you wish to log in using
 387 DSA or RSA authentication. There is no need to keep the contents of these files
 388 secret.
 389 .RE
 390 
 391 .SH ATTRIBUTES
 392 .LP
 393 See \fBattributes\fR(5) for descriptions of the following attributes:
 394 .sp
 395 
 396 .sp
 397 .TS
 398 box;
 399 c | c
 400 l | l .
 401 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 402 _
 403 Interface Stability     Committed
 404 .TE
 405 
 406 .SH SEE ALSO
 407 .LP
 408 \fBssh\fR(1), \fBssh-add\fR(1), \fBssh-agent\fR(1), \fBsshd\fR(1M),
 409 \fBattributes\fR(5)