blob: 33713446522ae6d1527348ed51aa8ef43b2ce61a [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
171This option will read a
Damien Miller30c3d422000-05-09 11:02:59 +1000172SSH2-compatible public key file and print an OpenSSH DSA compatible public key to stdout.
Damien Millere247cc42000-05-07 12:03:14 +1000173.It Fl y
174This option will read a private
Damien Miller30c3d422000-05-09 11:02:59 +1000175OpenSSH DSA format file and print an OpenSSH DSA public key to stdout.
Damien Miller32aa1441999-10-29 09:15:49 +1000176.El
177.Sh FILES
178.Bl -tag -width Ds
Damien Miller32aa1441999-10-29 09:15:49 +1000179.It Pa $HOME/.ssh/identity
Damien Miller450a7a12000-03-26 13:04:51 +1000180Contains the RSA authentication identity of the user.
181This file should not be readable by anyone but the user.
182It is possible to
Damien Miller32aa1441999-10-29 09:15:49 +1000183specify a passphrase when generating the key; that passphrase will be
Damien Miller450a7a12000-03-26 13:04:51 +1000184used to encrypt the private part of this file using 3DES.
185This file is not automatically accessed by
Damien Miller32aa1441999-10-29 09:15:49 +1000186.Nm
187but it is offered as the default file for the private key.
Damien Millere247cc42000-05-07 12:03:14 +1000188.Xr sshd 8
189will read this file when a login attempt is made.
Damien Miller32aa1441999-10-29 09:15:49 +1000190.It Pa $HOME/.ssh/identity.pub
Damien Miller450a7a12000-03-26 13:04:51 +1000191Contains the public key for authentication.
192The contents of this file should be added to
Damien Miller32aa1441999-10-29 09:15:49 +1000193.Pa $HOME/.ssh/authorized_keys
194on all machines
Damien Miller450a7a12000-03-26 13:04:51 +1000195where you wish to log in using RSA authentication.
196There is no need to keep the contents of this file secret.
Damien Millere247cc42000-05-07 12:03:14 +1000197.It Pa $HOME/.ssh/id_dsa
198Contains the DSA authentication identity of the user.
199This file should not be readable by anyone but the user.
200It is possible to
201specify a passphrase when generating the key; that passphrase will be
202used to encrypt the private part of this file using 3DES.
203This file is not automatically accessed by
204.Nm
205but it is offered as the default file for the private key.
206.Xr sshd 8
207will read this file when a login attempt is made.
208.It Pa $HOME/.ssh/id_dsa.pub
209Contains the public key for authentication.
210The contents of this file should be added to
211.Pa $HOME/.ssh/authorized_keys2
212on all machines
213where you wish to log in using DSA authentication.
214There is no need to keep the contents of this file secret.
Damien Miller37023962000-07-11 17:31:38 +1000215.El
Damien Miller32aa1441999-10-29 09:15:49 +1000216.Sh AUTHOR
217Tatu Ylonen <ylo@cs.hut.fi>
218.Pp
219OpenSSH
220is a derivative of the original (free) ssh 1.2.12 release, but with bugs
Damien Miller450a7a12000-03-26 13:04:51 +1000221removed and newer features re-added.
222Rapidly after the 1.2.12 release,
223newer versions bore successively more restrictive licenses.
224This version of OpenSSH
Damien Miller32aa1441999-10-29 09:15:49 +1000225.Bl -bullet
226.It
Damien Millere4340be2000-09-16 13:29:08 +1100227has all components of a restrictive nature (i.e., patents, see
228.Xr crypto 3 )
Damien Miller32aa1441999-10-29 09:15:49 +1000229directly removed from the source code; any licensed or patented components
230are chosen from
231external libraries.
232.It
233has been updated to support ssh protocol 1.5.
234.It
Damien Miller22c77262000-04-13 12:26:34 +1000235contains added support for
Damien Miller32aa1441999-10-29 09:15:49 +1000236.Xr kerberos 8
237authentication and ticket passing.
238.It
239supports one-time password authentication with
240.Xr skey 1 .
241.El
Damien Miller32aa1441999-10-29 09:15:49 +1000242.Sh SEE ALSO
243.Xr ssh 1 ,
244.Xr ssh-add 1 ,
Damien Miller2e8b1c81999-11-15 23:33:56 +1100245.Xr ssh-agent 1 ,
Damien Miller32aa1441999-10-29 09:15:49 +1000246.Xr sshd 8 ,
Damien Millere4340be2000-09-16 13:29:08 +1100247.Xr crypto 3