blob: 9a32ad8597b8b4f53187b86039a44f32ea335b86 [file] [log] [blame]
Damien Miller32aa1441999-10-29 09:15:49 +10001.\" -*- 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 Miller30c3d422000-05-09 11:02:59 +100012.\" $Id: ssh-keygen.1,v 1.15 2000/05/09 01:03:02 damien Exp $
Damien Miller32aa1441999-10-29 09:15:49 +100013.\"
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 Millere247cc42000-05-07 12:03:14 +100022.Op Fl dq
Damien Miller32aa1441999-10-29 09:15:49 +100023.Op Fl b Ar bits
24.Op Fl N Ar new_passphrase
25.Op Fl C Ar comment
Damien Miller10f6f6b1999-11-17 17:29:08 +110026.Op Fl f Ar keyfile
Damien Miller32aa1441999-10-29 09:15:49 +100027.Nm ssh-keygen
28.Fl p
29.Op Fl P Ar old_passphrase
30.Op Fl N Ar new_passphrase
Damien Miller10f6f6b1999-11-17 17:29:08 +110031.Op Fl f Ar keyfile
Damien Miller32aa1441999-10-29 09:15:49 +100032.Nm ssh-keygen
Damien Millere247cc42000-05-07 12:03:14 +100033.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 Miller32aa1441999-10-29 09:15:49 +100042.Fl c
43.Op Fl P Ar passphrase
44.Op Fl C Ar comment
Damien Miller10f6f6b1999-11-17 17:29:08 +110045.Op Fl f Ar keyfile
46.Nm ssh-keygen
47.Fl l
48.Op Fl f Ar keyfile
Damien Millereba71ba2000-04-29 23:57:08 +100049.Nm ssh-keygen
50.Fl R
Damien Miller22c77262000-04-13 12:26:34 +100051.Sh DESCRIPTION
Damien Miller32aa1441999-10-29 09:15:49 +100052.Nm
Damien Miller22c77262000-04-13 12:26:34 +100053generates and manages authentication keys for
Damien Miller32aa1441999-10-29 09:15:49 +100054.Xr ssh 1 .
Damien Millere247cc42000-05-07 12:03:14 +100055.Nm
56defaults to generating an RSA key for use by protocols 1.3 and 1.5;
57specifying the
58.Fl d
59flag will create a DSA key instead for use by protocol 2.0.
60.Pp
Damien Miller32aa1441999-10-29 09:15:49 +100061Normally each user wishing to use SSH
Damien Millere247cc42000-05-07 12:03:14 +100062with RSA or DSA authentication runs this once to create the authentication
Damien Miller32aa1441999-10-29 09:15:49 +100063key in
Damien Millere247cc42000-05-07 12:03:14 +100064.Pa $HOME/.ssh/identity
65or
66.Pa $HOME/.ssh/id_dsa .
67Additionally, the system administrator may use this to generate host keys,
68as seen in
69.Pa /etc/rc .
Damien Miller32aa1441999-10-29 09:15:49 +100070.Pp
71Normally this program generates the key and asks for a file in which
Damien Miller450a7a12000-03-26 13:04:51 +100072to store the private key.
73The public key is stored in a file with the same name but
Damien Miller32aa1441999-10-29 09:15:49 +100074.Dq .pub
Damien Miller450a7a12000-03-26 13:04:51 +100075appended.
76The program also asks for a passphrase.
77The passphrase may be empty to indicate no passphrase
Damien Miller32aa1441999-10-29 09:15:49 +100078(host keys must have empty passphrase), or it may be a string of
Damien Miller450a7a12000-03-26 13:04:51 +100079arbitrary length.
80Good passphrases are 10-30 characters long and are
Damien Miller32aa1441999-10-29 09:15:49 +100081not simple sentences or otherwise easily guessable (English
82prose has only 1-2 bits of entropy per word, and provides very bad
Damien Miller450a7a12000-03-26 13:04:51 +100083passphrases).
84The passphrase can be changed later by using the
Damien Miller32aa1441999-10-29 09:15:49 +100085.Fl p
86option.
87.Pp
Damien Miller450a7a12000-03-26 13:04:51 +100088There is no way to recover a lost passphrase.
89If the passphrase is
Damien Miller32aa1441999-10-29 09:15:49 +100090lost or forgotten, you will have to generate a new key and copy the
91corresponding public key to other machines.
92.Pp
Damien Millere247cc42000-05-07 12:03:14 +100093For RSA, there is also a comment field in the key file that is only for
Damien Miller450a7a12000-03-26 13:04:51 +100094convenience to the user to help identify the key.
95The comment can tell what the key is for, or whatever is useful.
96The comment is initialized to
Damien Miller32aa1441999-10-29 09:15:49 +100097.Dq user@host
98when the key is created, but can be changed using the
99.Fl c
100option.
101.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000102After a key is generated, instructions below detail where the keys
103should be placed to be activated.
104.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000105The options are as follows:
106.Bl -tag -width Ds
107.It Fl b Ar bits
Damien Miller450a7a12000-03-26 13:04:51 +1000108Specifies the number of bits in the key to create.
109Minimum is 512 bits.
110Generally 1024 bits is considered sufficient, and key sizes
111above that no longer improve security but make things slower.
112The default is 1024 bits.
Damien Miller32aa1441999-10-29 09:15:49 +1000113.It Fl c
114Requests changing the comment in the private and public key files.
115The program will prompt for the file containing the private keys, for
116passphrase if the key has one, and for the new comment.
Damien Miller10f6f6b1999-11-17 17:29:08 +1100117.It Fl f
118Specifies the filename of the key file.
119.It Fl l
120Show fingerprint of specified private or public key file.
Damien Miller32aa1441999-10-29 09:15:49 +1000121.It Fl p
122Requests changing the passphrase of a private key file instead of
Damien Miller450a7a12000-03-26 13:04:51 +1000123creating a new private key.
124The program will prompt for the file
Damien Miller32aa1441999-10-29 09:15:49 +1000125containing the private key, for the old passphrase, and twice for the
126new passphrase.
127.It Fl q
128Silence
129.Nm ssh-keygen .
130Used by
131.Pa /etc/rc
132when creating a new key.
133.It Fl C Ar comment
134Provides the new comment.
135.It Fl N Ar new_passphrase
136Provides the new passphrase.
137.It Fl P Ar passphrase
138Provides the (old) passphrase.
Damien Millereba71ba2000-04-29 23:57:08 +1000139.It Fl R
140If RSA support is functional, immediately exits with code 0. If RSA
141support is not functional, exits with code 1. This flag will be
142removed once the RSA patent expires.
Damien Millere247cc42000-05-07 12:03:14 +1000143.It Fl x
144This option will read a private
Damien Miller30c3d422000-05-09 11:02:59 +1000145OpenSSH DSA format file and print a SSH2-compatible public key to stdout.
Damien Millere247cc42000-05-07 12:03:14 +1000146.It Fl X
147This option will read a
Damien Miller30c3d422000-05-09 11:02:59 +1000148SSH2-compatible public key file and print an OpenSSH DSA compatible public key to stdout.
Damien Millere247cc42000-05-07 12:03:14 +1000149.It Fl y
150This option will read a private
Damien Miller30c3d422000-05-09 11:02:59 +1000151OpenSSH DSA format file and print an OpenSSH DSA public key to stdout.
Damien Miller32aa1441999-10-29 09:15:49 +1000152.El
153.Sh FILES
154.Bl -tag -width Ds
Damien Miller32aa1441999-10-29 09:15:49 +1000155.It Pa $HOME/.ssh/identity
Damien Miller450a7a12000-03-26 13:04:51 +1000156Contains the RSA authentication identity of the user.
157This file should not be readable by anyone but the user.
158It is possible to
Damien Miller32aa1441999-10-29 09:15:49 +1000159specify a passphrase when generating the key; that passphrase will be
Damien Miller450a7a12000-03-26 13:04:51 +1000160used to encrypt the private part of this file using 3DES.
161This file is not automatically accessed by
Damien Miller32aa1441999-10-29 09:15:49 +1000162.Nm
163but it is offered as the default file for the private key.
Damien Millere247cc42000-05-07 12:03:14 +1000164.Xr sshd 8
165will read this file when a login attempt is made.
Damien Miller32aa1441999-10-29 09:15:49 +1000166.It Pa $HOME/.ssh/identity.pub
Damien Miller450a7a12000-03-26 13:04:51 +1000167Contains the public key for authentication.
168The contents of this file should be added to
Damien Miller32aa1441999-10-29 09:15:49 +1000169.Pa $HOME/.ssh/authorized_keys
170on all machines
Damien Miller450a7a12000-03-26 13:04:51 +1000171where you wish to log in using RSA authentication.
172There is no need to keep the contents of this file secret.
Damien Millere247cc42000-05-07 12:03:14 +1000173.It Pa $HOME/.ssh/id_dsa
174Contains the DSA authentication identity of the user.
175This file should not be readable by anyone but the user.
176It is possible to
177specify a passphrase when generating the key; that passphrase will be
178used to encrypt the private part of this file using 3DES.
179This file is not automatically accessed by
180.Nm
181but it is offered as the default file for the private key.
182.Xr sshd 8
183will read this file when a login attempt is made.
184.It Pa $HOME/.ssh/id_dsa.pub
185Contains the public key for authentication.
186The contents of this file should be added to
187.Pa $HOME/.ssh/authorized_keys2
188on all machines
189where you wish to log in using DSA authentication.
190There is no need to keep the contents of this file secret.
Damien Miller32aa1441999-10-29 09:15:49 +1000191.Sh AUTHOR
192Tatu Ylonen <ylo@cs.hut.fi>
193.Pp
194OpenSSH
195is a derivative of the original (free) ssh 1.2.12 release, but with bugs
Damien Miller450a7a12000-03-26 13:04:51 +1000196removed and newer features re-added.
197Rapidly after the 1.2.12 release,
198newer versions bore successively more restrictive licenses.
199This version of OpenSSH
Damien Miller32aa1441999-10-29 09:15:49 +1000200.Bl -bullet
201.It
Damien Millercfabe862000-04-20 23:27:27 +1000202has all components of a restrictive nature (i.e., patents)
Damien Miller32aa1441999-10-29 09:15:49 +1000203directly removed from the source code; any licensed or patented components
204are chosen from
205external libraries.
206.It
207has been updated to support ssh protocol 1.5.
208.It
Damien Miller22c77262000-04-13 12:26:34 +1000209contains added support for
Damien Miller32aa1441999-10-29 09:15:49 +1000210.Xr kerberos 8
211authentication and ticket passing.
212.It
213supports one-time password authentication with
214.Xr skey 1 .
215.El
Damien Miller32aa1441999-10-29 09:15:49 +1000216.Sh SEE ALSO
217.Xr ssh 1 ,
218.Xr ssh-add 1 ,
Damien Miller2e8b1c81999-11-15 23:33:56 +1100219.Xr ssh-agent 1 ,
Damien Miller32aa1441999-10-29 09:15:49 +1000220.Xr sshd 8 ,