Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 1 | .\" -*- nroff -*- |
| 2 | .\" |
| 3 | .\" ssh-keygen.1 |
| 4 | .\" |
| 5 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> |
| 6 | .\" |
| 7 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
| 8 | .\" All rights reserved |
| 9 | .\" |
| 10 | .\" Created: Sat Apr 22 23:55:14 1995 ylo |
| 11 | .\" |
Damien Miller | 3702396 | 2000-07-11 17:31:38 +1000 | [diff] [blame] | 12 | .\" $Id: ssh-keygen.1,v 1.16 2000/07/11 07:31:38 djm Exp $ |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 13 | .\" |
| 14 | .Dd September 25, 1999 |
| 15 | .Dt SSH-KEYGEN 1 |
| 16 | .Os |
| 17 | .Sh NAME |
| 18 | .Nm ssh-keygen |
| 19 | .Nd authentication key generation |
| 20 | .Sh SYNOPSIS |
| 21 | .Nm ssh-keygen |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 22 | .Op Fl dq |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 23 | .Op Fl b Ar bits |
| 24 | .Op Fl N Ar new_passphrase |
| 25 | .Op Fl C Ar comment |
Damien Miller | 10f6f6b | 1999-11-17 17:29:08 +1100 | [diff] [blame] | 26 | .Op Fl f Ar keyfile |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 27 | .Nm ssh-keygen |
| 28 | .Fl p |
| 29 | .Op Fl P Ar old_passphrase |
| 30 | .Op Fl N Ar new_passphrase |
Damien Miller | 10f6f6b | 1999-11-17 17:29:08 +1100 | [diff] [blame] | 31 | .Op Fl f Ar keyfile |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 32 | .Nm ssh-keygen |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 33 | .Fl x |
| 34 | .Op Fl f Ar keyfile |
| 35 | .Nm ssh-keygen |
| 36 | .Fl X |
| 37 | .Op Fl f Ar keyfile |
| 38 | .Nm ssh-keygen |
| 39 | .Fl y |
| 40 | .Op Fl f Ar keyfile |
| 41 | .Nm ssh-keygen |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 42 | .Fl c |
| 43 | .Op Fl P Ar passphrase |
| 44 | .Op Fl C Ar comment |
Damien Miller | 10f6f6b | 1999-11-17 17:29:08 +1100 | [diff] [blame] | 45 | .Op Fl f Ar keyfile |
| 46 | .Nm ssh-keygen |
| 47 | .Fl l |
| 48 | .Op Fl f Ar keyfile |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 49 | .Nm ssh-keygen |
| 50 | .Fl R |
Damien Miller | 22c7726 | 2000-04-13 12:26:34 +1000 | [diff] [blame] | 51 | .Sh DESCRIPTION |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 52 | .Nm |
Damien Miller | 22c7726 | 2000-04-13 12:26:34 +1000 | [diff] [blame] | 53 | generates and manages authentication keys for |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 54 | .Xr ssh 1 . |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 55 | .Nm |
| 56 | defaults to generating an RSA key for use by protocols 1.3 and 1.5; |
| 57 | specifying the |
| 58 | .Fl d |
| 59 | flag will create a DSA key instead for use by protocol 2.0. |
| 60 | .Pp |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 61 | Normally each user wishing to use SSH |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 62 | with RSA or DSA authentication runs this once to create the authentication |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 63 | key in |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 64 | .Pa $HOME/.ssh/identity |
| 65 | or |
| 66 | .Pa $HOME/.ssh/id_dsa . |
| 67 | Additionally, the system administrator may use this to generate host keys, |
| 68 | as seen in |
| 69 | .Pa /etc/rc . |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 70 | .Pp |
| 71 | Normally this program generates the key and asks for a file in which |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 72 | to store the private key. |
| 73 | The public key is stored in a file with the same name but |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 74 | .Dq .pub |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 75 | appended. |
| 76 | The program also asks for a passphrase. |
| 77 | The passphrase may be empty to indicate no passphrase |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 78 | (host keys must have empty passphrase), or it may be a string of |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 79 | arbitrary length. |
| 80 | Good passphrases are 10-30 characters long and are |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 81 | not simple sentences or otherwise easily guessable (English |
| 82 | prose has only 1-2 bits of entropy per word, and provides very bad |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 83 | passphrases). |
| 84 | The passphrase can be changed later by using the |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 85 | .Fl p |
| 86 | option. |
| 87 | .Pp |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 88 | There is no way to recover a lost passphrase. |
| 89 | If the passphrase is |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 90 | lost or forgotten, you will have to generate a new key and copy the |
| 91 | corresponding public key to other machines. |
| 92 | .Pp |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 93 | For RSA, there is also a comment field in the key file that is only for |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 94 | convenience to the user to help identify the key. |
| 95 | The comment can tell what the key is for, or whatever is useful. |
| 96 | The comment is initialized to |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 97 | .Dq user@host |
| 98 | when the key is created, but can be changed using the |
| 99 | .Fl c |
| 100 | option. |
| 101 | .Pp |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 102 | After a key is generated, instructions below detail where the keys |
| 103 | should be placed to be activated. |
| 104 | .Pp |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 105 | The options are as follows: |
| 106 | .Bl -tag -width Ds |
| 107 | .It Fl b Ar bits |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 108 | Specifies the number of bits in the key to create. |
| 109 | Minimum is 512 bits. |
| 110 | Generally 1024 bits is considered sufficient, and key sizes |
| 111 | above that no longer improve security but make things slower. |
| 112 | The default is 1024 bits. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 113 | .It Fl c |
| 114 | Requests changing the comment in the private and public key files. |
| 115 | The program will prompt for the file containing the private keys, for |
| 116 | passphrase if the key has one, and for the new comment. |
Damien Miller | 10f6f6b | 1999-11-17 17:29:08 +1100 | [diff] [blame] | 117 | .It Fl f |
| 118 | Specifies the filename of the key file. |
| 119 | .It Fl l |
| 120 | Show fingerprint of specified private or public key file. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 121 | .It Fl p |
| 122 | Requests changing the passphrase of a private key file instead of |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 123 | creating a new private key. |
| 124 | The program will prompt for the file |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 125 | containing the private key, for the old passphrase, and twice for the |
| 126 | new passphrase. |
| 127 | .It Fl q |
| 128 | Silence |
| 129 | .Nm ssh-keygen . |
| 130 | Used by |
| 131 | .Pa /etc/rc |
| 132 | when creating a new key. |
| 133 | .It Fl C Ar comment |
| 134 | Provides the new comment. |
| 135 | .It Fl N Ar new_passphrase |
| 136 | Provides the new passphrase. |
| 137 | .It Fl P Ar passphrase |
| 138 | Provides the (old) passphrase. |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 139 | .It Fl R |
| 140 | If RSA support is functional, immediately exits with code 0. If RSA |
| 141 | support is not functional, exits with code 1. This flag will be |
| 142 | removed once the RSA patent expires. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 143 | .It Fl x |
| 144 | This option will read a private |
Damien Miller | 30c3d42 | 2000-05-09 11:02:59 +1000 | [diff] [blame] | 145 | OpenSSH DSA format file and print a SSH2-compatible public key to stdout. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 146 | .It Fl X |
| 147 | This option will read a |
Damien Miller | 30c3d42 | 2000-05-09 11:02:59 +1000 | [diff] [blame] | 148 | SSH2-compatible public key file and print an OpenSSH DSA compatible public key to stdout. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 149 | .It Fl y |
| 150 | This option will read a private |
Damien Miller | 30c3d42 | 2000-05-09 11:02:59 +1000 | [diff] [blame] | 151 | OpenSSH DSA format file and print an OpenSSH DSA public key to stdout. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 152 | .El |
| 153 | .Sh FILES |
| 154 | .Bl -tag -width Ds |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 155 | .It Pa $HOME/.ssh/identity |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 156 | Contains the RSA authentication identity of the user. |
| 157 | This file should not be readable by anyone but the user. |
| 158 | It is possible to |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 159 | specify a passphrase when generating the key; that passphrase will be |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 160 | used to encrypt the private part of this file using 3DES. |
| 161 | This file is not automatically accessed by |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 162 | .Nm |
| 163 | but it is offered as the default file for the private key. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 164 | .Xr sshd 8 |
| 165 | will read this file when a login attempt is made. |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 166 | .It Pa $HOME/.ssh/identity.pub |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 167 | Contains the public key for authentication. |
| 168 | The contents of this file should be added to |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 169 | .Pa $HOME/.ssh/authorized_keys |
| 170 | on all machines |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 171 | where you wish to log in using RSA authentication. |
| 172 | There is no need to keep the contents of this file secret. |
Damien Miller | e247cc4 | 2000-05-07 12:03:14 +1000 | [diff] [blame] | 173 | .It Pa $HOME/.ssh/id_dsa |
| 174 | Contains the DSA authentication identity of the user. |
| 175 | This file should not be readable by anyone but the user. |
| 176 | It is possible to |
| 177 | specify a passphrase when generating the key; that passphrase will be |
| 178 | used to encrypt the private part of this file using 3DES. |
| 179 | This file is not automatically accessed by |
| 180 | .Nm |
| 181 | but it is offered as the default file for the private key. |
| 182 | .Xr sshd 8 |
| 183 | will read this file when a login attempt is made. |
| 184 | .It Pa $HOME/.ssh/id_dsa.pub |
| 185 | Contains the public key for authentication. |
| 186 | The contents of this file should be added to |
| 187 | .Pa $HOME/.ssh/authorized_keys2 |
| 188 | on all machines |
| 189 | where you wish to log in using DSA authentication. |
| 190 | There is no need to keep the contents of this file secret. |
Damien Miller | 3702396 | 2000-07-11 17:31:38 +1000 | [diff] [blame] | 191 | .El |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 192 | .Sh AUTHOR |
| 193 | Tatu Ylonen <ylo@cs.hut.fi> |
| 194 | .Pp |
| 195 | OpenSSH |
| 196 | is a derivative of the original (free) ssh 1.2.12 release, but with bugs |
Damien Miller | 450a7a1 | 2000-03-26 13:04:51 +1000 | [diff] [blame] | 197 | removed and newer features re-added. |
| 198 | Rapidly after the 1.2.12 release, |
| 199 | newer versions bore successively more restrictive licenses. |
| 200 | This version of OpenSSH |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 201 | .Bl -bullet |
| 202 | .It |
Damien Miller | cfabe86 | 2000-04-20 23:27:27 +1000 | [diff] [blame] | 203 | has all components of a restrictive nature (i.e., patents) |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 204 | directly removed from the source code; any licensed or patented components |
| 205 | are chosen from |
| 206 | external libraries. |
| 207 | .It |
| 208 | has been updated to support ssh protocol 1.5. |
| 209 | .It |
Damien Miller | 22c7726 | 2000-04-13 12:26:34 +1000 | [diff] [blame] | 210 | contains added support for |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 211 | .Xr kerberos 8 |
| 212 | authentication and ticket passing. |
| 213 | .It |
| 214 | supports one-time password authentication with |
| 215 | .Xr skey 1 . |
| 216 | .El |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 217 | .Sh SEE ALSO |
| 218 | .Xr ssh 1 , |
| 219 | .Xr ssh-add 1 , |
Damien Miller | 2e8b1c8 | 1999-11-15 23:33:56 +1100 | [diff] [blame] | 220 | .Xr ssh-agent 1 , |
Damien Miller | 32aa144 | 1999-10-29 09:15:49 +1000 | [diff] [blame] | 221 | .Xr sshd 8 , |