blob: b91a09827975a80f146aa2d0943cc6df13d92421 [file] [log] [blame]
Damien Miller32aa1441999-10-29 09:15:49 +10001.\" -*- nroff -*-
2.\"
Damien Miller32aa1441999-10-29 09:15:49 +10003.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
Damien Miller32aa1441999-10-29 09:15:49 +10004.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5.\" All rights reserved
6.\"
Damien Millere4340be2000-09-16 13:29:08 +11007.\" As far as I am concerned, the code I have written for this software
8.\" can be used freely for any purpose. Any derived versions of this
9.\" software must be clearly marked as such, and if the derived work is
10.\" incompatible with the protocol description in the RFC file, it must be
11.\" called by a name other than "ssh" or "Secure Shell".
Damien Miller32aa1441999-10-29 09:15:49 +100012.\"
Damien Millere4340be2000-09-16 13:29:08 +110013.\"
14.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
15.\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
16.\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
17.\"
18.\" Redistribution and use in source and binary forms, with or without
19.\" modification, are permitted provided that the following conditions
20.\" are met:
21.\" 1. Redistributions of source code must retain the above copyright
22.\" notice, this list of conditions and the following disclaimer.
23.\" 2. Redistributions in binary form must reproduce the above copyright
24.\" notice, this list of conditions and the following disclaimer in the
25.\" documentation and/or other materials provided with the distribution.
26.\"
27.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Damien Miller32aa1441999-10-29 09:15:49 +100037.\"
38.Dd September 25, 1999
39.Dt SSH-KEYGEN 1
40.Os
41.Sh NAME
42.Nm ssh-keygen
43.Nd authentication key generation
44.Sh SYNOPSIS
45.Nm ssh-keygen
Damien Millere247cc42000-05-07 12:03:14 +100046.Op Fl dq
Damien Miller32aa1441999-10-29 09:15:49 +100047.Op Fl b Ar bits
48.Op Fl N Ar new_passphrase
49.Op Fl C Ar comment
Damien Miller1a425f32000-09-02 10:08:09 +110050.Op Fl f Ar output_keyfile
Damien Miller32aa1441999-10-29 09:15:49 +100051.Nm ssh-keygen
52.Fl p
53.Op Fl P Ar old_passphrase
54.Op Fl N Ar new_passphrase
Damien Miller10f6f6b1999-11-17 17:29:08 +110055.Op Fl f Ar keyfile
Damien Miller32aa1441999-10-29 09:15:49 +100056.Nm ssh-keygen
Damien Millere247cc42000-05-07 12:03:14 +100057.Fl x
Damien Miller1a425f32000-09-02 10:08:09 +110058.Op Fl f Ar input_keyfile
Damien Millere247cc42000-05-07 12:03:14 +100059.Nm ssh-keygen
60.Fl X
Damien Miller1a425f32000-09-02 10:08:09 +110061.Op Fl f Ar input_keyfile
Damien Millere247cc42000-05-07 12:03:14 +100062.Nm ssh-keygen
63.Fl y
Damien Miller1a425f32000-09-02 10:08:09 +110064.Op Fl f Ar input_keyfile
Damien Millere247cc42000-05-07 12:03:14 +100065.Nm ssh-keygen
Damien Miller32aa1441999-10-29 09:15:49 +100066.Fl c
67.Op Fl P Ar passphrase
68.Op Fl C Ar comment
Damien Miller10f6f6b1999-11-17 17:29:08 +110069.Op Fl f Ar keyfile
70.Nm ssh-keygen
71.Fl l
Damien Miller1a425f32000-09-02 10:08:09 +110072.Op Fl f Ar input_keyfile
Damien Millereba71ba2000-04-29 23:57:08 +100073.Nm ssh-keygen
74.Fl R
Damien Miller22c77262000-04-13 12:26:34 +100075.Sh DESCRIPTION
Damien Miller32aa1441999-10-29 09:15:49 +100076.Nm
Damien Miller22c77262000-04-13 12:26:34 +100077generates and manages authentication keys for
Damien Miller32aa1441999-10-29 09:15:49 +100078.Xr ssh 1 .
Damien Millere247cc42000-05-07 12:03:14 +100079.Nm
80defaults to generating an RSA key for use by protocols 1.3 and 1.5;
81specifying the
82.Fl d
83flag will create a DSA key instead for use by protocol 2.0.
84.Pp
Damien Miller32aa1441999-10-29 09:15:49 +100085Normally each user wishing to use SSH
Damien Millere247cc42000-05-07 12:03:14 +100086with RSA or DSA authentication runs this once to create the authentication
Damien Miller32aa1441999-10-29 09:15:49 +100087key in
Damien Millere247cc42000-05-07 12:03:14 +100088.Pa $HOME/.ssh/identity
89or
90.Pa $HOME/.ssh/id_dsa .
91Additionally, the system administrator may use this to generate host keys,
92as seen in
93.Pa /etc/rc .
Damien Miller32aa1441999-10-29 09:15:49 +100094.Pp
95Normally this program generates the key and asks for a file in which
Damien Miller450a7a12000-03-26 13:04:51 +100096to store the private key.
97The public key is stored in a file with the same name but
Damien Miller32aa1441999-10-29 09:15:49 +100098.Dq .pub
Damien Miller450a7a12000-03-26 13:04:51 +100099appended.
100The program also asks for a passphrase.
101The passphrase may be empty to indicate no passphrase
Damien Miller32aa1441999-10-29 09:15:49 +1000102(host keys must have empty passphrase), or it may be a string of
Damien Miller450a7a12000-03-26 13:04:51 +1000103arbitrary length.
104Good passphrases are 10-30 characters long and are
Damien Miller32aa1441999-10-29 09:15:49 +1000105not simple sentences or otherwise easily guessable (English
106prose has only 1-2 bits of entropy per word, and provides very bad
Damien Miller450a7a12000-03-26 13:04:51 +1000107passphrases).
108The passphrase can be changed later by using the
Damien Miller32aa1441999-10-29 09:15:49 +1000109.Fl p
110option.
111.Pp
Damien Miller450a7a12000-03-26 13:04:51 +1000112There is no way to recover a lost passphrase.
113If the passphrase is
Damien Miller32aa1441999-10-29 09:15:49 +1000114lost or forgotten, you will have to generate a new key and copy the
115corresponding public key to other machines.
116.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000117For RSA, there is also a comment field in the key file that is only for
Damien Miller450a7a12000-03-26 13:04:51 +1000118convenience to the user to help identify the key.
119The comment can tell what the key is for, or whatever is useful.
120The comment is initialized to
Damien Miller32aa1441999-10-29 09:15:49 +1000121.Dq user@host
122when the key is created, but can be changed using the
123.Fl c
124option.
125.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000126After a key is generated, instructions below detail where the keys
127should be placed to be activated.
128.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000129The options are as follows:
130.Bl -tag -width Ds
131.It Fl b Ar bits
Damien Miller450a7a12000-03-26 13:04:51 +1000132Specifies the number of bits in the key to create.
133Minimum is 512 bits.
134Generally 1024 bits is considered sufficient, and key sizes
135above that no longer improve security but make things slower.
136The default is 1024 bits.
Damien Miller32aa1441999-10-29 09:15:49 +1000137.It Fl c
138Requests changing the comment in the private and public key files.
139The program will prompt for the file containing the private keys, for
140passphrase if the key has one, and for the new comment.
Damien Miller10f6f6b1999-11-17 17:29:08 +1100141.It Fl f
142Specifies the filename of the key file.
143.It Fl l
144Show fingerprint of specified private or public key file.
Damien Miller32aa1441999-10-29 09:15:49 +1000145.It Fl p
146Requests changing the passphrase of a private key file instead of
Damien Miller450a7a12000-03-26 13:04:51 +1000147creating a new private key.
148The program will prompt for the file
Damien Miller32aa1441999-10-29 09:15:49 +1000149containing the private key, for the old passphrase, and twice for the
150new passphrase.
151.It Fl q
152Silence
153.Nm ssh-keygen .
154Used by
155.Pa /etc/rc
156when creating a new key.
157.It Fl C Ar comment
158Provides the new comment.
159.It Fl N Ar new_passphrase
160Provides the new passphrase.
161.It Fl P Ar passphrase
162Provides the (old) passphrase.
Damien Millereba71ba2000-04-29 23:57:08 +1000163.It Fl R
164If RSA support is functional, immediately exits with code 0. If RSA
165support is not functional, exits with code 1. This flag will be
166removed once the RSA patent expires.
Damien Millere247cc42000-05-07 12:03:14 +1000167.It Fl x
168This option will read a private
Damien Miller30c3d422000-05-09 11:02:59 +1000169OpenSSH DSA format file and print a SSH2-compatible public key to stdout.
Damien Millere247cc42000-05-07 12:03:14 +1000170.It Fl X
Damien Miller874d77b2000-10-14 16:23:11 +1100171This option will read a unencrypted
172SSH2-compatible private (or public) key file and
173print an OpenSSH compatible private (or public) key to stdout.
Damien Millere247cc42000-05-07 12:03:14 +1000174.It Fl y
175This option will read a private
Damien Miller30c3d422000-05-09 11:02:59 +1000176OpenSSH DSA format file and print an OpenSSH DSA public key to stdout.
Damien Miller32aa1441999-10-29 09:15:49 +1000177.El
178.Sh FILES
179.Bl -tag -width Ds
Damien Miller32aa1441999-10-29 09:15:49 +1000180.It Pa $HOME/.ssh/identity
Damien Miller450a7a12000-03-26 13:04:51 +1000181Contains the RSA authentication identity of the user.
182This file should not be readable by anyone but the user.
183It is possible to
Damien Miller32aa1441999-10-29 09:15:49 +1000184specify a passphrase when generating the key; that passphrase will be
Damien Miller450a7a12000-03-26 13:04:51 +1000185used to encrypt the private part of this file using 3DES.
186This file is not automatically accessed by
Damien Miller32aa1441999-10-29 09:15:49 +1000187.Nm
188but it is offered as the default file for the private key.
Damien Millere247cc42000-05-07 12:03:14 +1000189.Xr sshd 8
190will read this file when a login attempt is made.
Damien Miller32aa1441999-10-29 09:15:49 +1000191.It Pa $HOME/.ssh/identity.pub
Damien Miller450a7a12000-03-26 13:04:51 +1000192Contains the public key for authentication.
193The contents of this file should be added to
Damien Miller32aa1441999-10-29 09:15:49 +1000194.Pa $HOME/.ssh/authorized_keys
195on all machines
Damien Miller450a7a12000-03-26 13:04:51 +1000196where you wish to log in using RSA authentication.
197There is no need to keep the contents of this file secret.
Damien Millere247cc42000-05-07 12:03:14 +1000198.It Pa $HOME/.ssh/id_dsa
199Contains the DSA authentication identity of the user.
200This file should not be readable by anyone but the user.
201It is possible to
202specify a passphrase when generating the key; that passphrase will be
203used to encrypt the private part of this file using 3DES.
204This file is not automatically accessed by
205.Nm
206but it is offered as the default file for the private key.
207.Xr sshd 8
208will read this file when a login attempt is made.
209.It Pa $HOME/.ssh/id_dsa.pub
210Contains the public key for authentication.
211The contents of this file should be added to
212.Pa $HOME/.ssh/authorized_keys2
213on all machines
214where you wish to log in using DSA authentication.
215There is no need to keep the contents of this file secret.
Damien Miller37023962000-07-11 17:31:38 +1000216.El
Damien Miller32aa1441999-10-29 09:15:49 +1000217.Sh AUTHOR
218Tatu Ylonen <ylo@cs.hut.fi>
219.Pp
220OpenSSH
221is a derivative of the original (free) ssh 1.2.12 release, but with bugs
Damien Miller450a7a12000-03-26 13:04:51 +1000222removed and newer features re-added.
223Rapidly after the 1.2.12 release,
224newer versions bore successively more restrictive licenses.
225This version of OpenSSH
Damien Miller32aa1441999-10-29 09:15:49 +1000226.Bl -bullet
227.It
Damien Millere4340be2000-09-16 13:29:08 +1100228has all components of a restrictive nature (i.e., patents, see
229.Xr crypto 3 )
Damien Miller32aa1441999-10-29 09:15:49 +1000230directly removed from the source code; any licensed or patented components
231are chosen from
232external libraries.
233.It
234has been updated to support ssh protocol 1.5.
235.It
Damien Miller22c77262000-04-13 12:26:34 +1000236contains added support for
Damien Miller32aa1441999-10-29 09:15:49 +1000237.Xr kerberos 8
238authentication and ticket passing.
239.It
240supports one-time password authentication with
241.Xr skey 1 .
242.El
Damien Miller32aa1441999-10-29 09:15:49 +1000243.Sh SEE ALSO
244.Xr ssh 1 ,
245.Xr ssh-add 1 ,
Damien Miller2e8b1c81999-11-15 23:33:56 +1100246.Xr ssh-agent 1 ,
Damien Miller32aa1441999-10-29 09:15:49 +1000247.Xr sshd 8 ,
Damien Millere4340be2000-09-16 13:29:08 +1100248.Xr crypto 3