summaryrefslogtreecommitdiff
path: root/ssh-keygen.1
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.1')
-rw-r--r--ssh-keygen.1120
1 files changed, 70 insertions, 50 deletions
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index 01711dfff..dfbc65ddb 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-keygen.1,v 1.133 2016/06/16 06:10:45 jmc Exp $ 1.\" $OpenBSD: ssh-keygen.1,v 1.144 2017/07/08 18:32:54 jmc Exp $
2.\" 2.\"
3.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -35,7 +35,7 @@
35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 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. 36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37.\" 37.\"
38.Dd $Mdocdate: June 16 2016 $ 38.Dd $Mdocdate: July 8 2017 $
39.Dt SSH-KEYGEN 1 39.Dt SSH-KEYGEN 1
40.Os 40.Os
41.Sh NAME 41.Sh NAME
@@ -46,7 +46,7 @@
46.Nm ssh-keygen 46.Nm ssh-keygen
47.Op Fl q 47.Op Fl q
48.Op Fl b Ar bits 48.Op Fl b Ar bits
49.Op Fl t Cm dsa | ecdsa | ed25519 | rsa | rsa1 49.Op Fl t Cm dsa | ecdsa | ed25519 | rsa
50.Op Fl N Ar new_passphrase 50.Op Fl N Ar new_passphrase
51.Op Fl C Ar comment 51.Op Fl C Ar comment
52.Op Fl f Ar output_keyfile 52.Op Fl f Ar output_keyfile
@@ -114,6 +114,8 @@
114.Fl s Ar ca_key 114.Fl s Ar ca_key
115.Fl I Ar certificate_identity 115.Fl I Ar certificate_identity
116.Op Fl h 116.Op Fl h
117.Op Fl U
118.Op Fl D Ar pkcs11_provider
117.Op Fl n Ar principals 119.Op Fl n Ar principals
118.Op Fl O Ar option 120.Op Fl O Ar option
119.Op Fl V Ar validity_interval 121.Op Fl V Ar validity_interval
@@ -124,6 +126,7 @@
124.Op Fl f Ar input_keyfile 126.Op Fl f Ar input_keyfile
125.Nm ssh-keygen 127.Nm ssh-keygen
126.Fl A 128.Fl A
129.Op Fl f Ar prefix_path
127.Nm ssh-keygen 130.Nm ssh-keygen
128.Fl k 131.Fl k
129.Fl f Ar krl_file 132.Fl f Ar krl_file
@@ -141,18 +144,14 @@
141generates, manages and converts authentication keys for 144generates, manages and converts authentication keys for
142.Xr ssh 1 . 145.Xr ssh 1 .
143.Nm 146.Nm
144can create keys for use by SSH protocol versions 1 and 2. 147can create keys for use by SSH protocol version 2.
145Protocol 1 should not be used
146and is only offered to support legacy devices.
147It suffers from a number of cryptographic weaknesses
148and doesn't support many of the advanced features available for protocol 2.
149.Pp 148.Pp
150The type of key to be generated is specified with the 149The type of key to be generated is specified with the
151.Fl t 150.Fl t
152option. 151option.
153If invoked without any arguments, 152If invoked without any arguments,
154.Nm 153.Nm
155will generate an RSA key for use in SSH protocol 2 connections. 154will generate an RSA key.
156.Pp 155.Pp
157.Nm 156.Nm
158is also used to generate groups for use in Diffie-Hellman group 157is also used to generate groups for use in Diffie-Hellman group
@@ -172,7 +171,6 @@ section for details.
172Normally each user wishing to use SSH 171Normally each user wishing to use SSH
173with public key authentication runs this once to create the authentication 172with public key authentication runs this once to create the authentication
174key in 173key in
175.Pa ~/.ssh/identity ,
176.Pa ~/.ssh/id_dsa , 174.Pa ~/.ssh/id_dsa ,
177.Pa ~/.ssh/id_ecdsa , 175.Pa ~/.ssh/id_ecdsa ,
178.Pa ~/.ssh/id_ed25519 176.Pa ~/.ssh/id_ed25519
@@ -205,7 +203,7 @@ There is no way to recover a lost passphrase.
205If the passphrase is lost or forgotten, a new key must be generated 203If the passphrase is lost or forgotten, a new key must be generated
206and the corresponding public key copied to other machines. 204and the corresponding public key copied to other machines.
207.Pp 205.Pp
208For RSA1 keys and keys stored in the newer OpenSSH format, 206For keys stored in the newer OpenSSH format,
209there is also a comment field in the key file that is only for 207there is also a comment field in the key file that is only for
210convenience to the user to help identify the key. 208convenience to the user to help identify the key.
211The comment can tell what the key is for, or whatever is useful. 209The comment can tell what the key is for, or whatever is useful.
@@ -221,22 +219,24 @@ should be placed to be activated.
221The options are as follows: 219The options are as follows:
222.Bl -tag -width Ds 220.Bl -tag -width Ds
223.It Fl A 221.It Fl A
224For each of the key types (rsa1, rsa, dsa, ecdsa and ed25519) 222For each of the key types (rsa, dsa, ecdsa and ed25519)
225for which host keys 223for which host keys
226do not exist, generate the host keys with the default key file path, 224do not exist, generate the host keys with the default key file path,
227an empty passphrase, default bits for the key type, and default comment. 225an empty passphrase, default bits for the key type, and default comment.
226If
227.Fl f
228has also been specified, its argument is used as a prefix to the
229default path for the resulting host key files.
228This is used by system administration scripts to generate new host keys. 230This is used by system administration scripts to generate new host keys.
229.It Fl a Ar rounds 231.It Fl a Ar rounds
230When saving a new-format private key (i.e. an ed25519 key or any SSH protocol 232When saving a new-format private key (i.e. an ed25519 key or when the
2312 key when the
232.Fl o 233.Fl o
233flag is set), this option specifies the number of KDF (key derivation function) 234flag is set), this option specifies the number of KDF (key derivation function)
234rounds used. 235rounds used.
235Higher numbers result in slower passphrase verification and increased 236Higher numbers result in slower passphrase verification and increased
236resistance to brute-force password cracking (should the keys be stolen). 237resistance to brute-force password cracking (should the keys be stolen).
237.Pp 238.Pp
238When screening DH-GEX candidates ( 239When screening DH-GEX candidates (using the
239using the
240.Fl T 240.Fl T
241command). 241command).
242This option specifies the number of primality tests to perform. 242This option specifies the number of primality tests to perform.
@@ -260,7 +260,7 @@ flag will be ignored.
260Provides a new comment. 260Provides a new comment.
261.It Fl c 261.It Fl c
262Requests changing the comment in the private and public key files. 262Requests changing the comment in the private and public key files.
263This operation is only supported for RSA1 keys and keys stored in the 263This operation is only supported for keys stored in the
264newer OpenSSH format. 264newer OpenSSH format.
265The program will prompt for the file containing the private keys, for 265The program will prompt for the file containing the private keys, for
266the passphrase if the key has one, and for the new comment. 266the passphrase if the key has one, and for the new comment.
@@ -380,7 +380,6 @@ section.
380Prints the contents of one or more certificates. 380Prints the contents of one or more certificates.
381.It Fl l 381.It Fl l
382Show fingerprint of specified public key file. 382Show fingerprint of specified public key file.
383Private RSA1 keys are also supported.
384For RSA and DSA keys 383For RSA and DSA keys
385.Nm 384.Nm
386tries to find the matching public key file and prints its fingerprint. 385tries to find the matching public key file and prints its fingerprint.
@@ -419,51 +418,81 @@ section for details.
419.It Fl O Ar option 418.It Fl O Ar option
420Specify a certificate option when signing a key. 419Specify a certificate option when signing a key.
421This option may be specified multiple times. 420This option may be specified multiple times.
422Please see the 421See also the
423.Sx CERTIFICATES 422.Sx CERTIFICATES
424section for details. 423section for further details.
425The options that are valid for user certificates are: 424The options that are valid for user certificates are:
426.Bl -tag -width Ds 425.Pp
426.Bl -tag -width Ds -compact
427.It Ic clear 427.It Ic clear
428Clear all enabled permissions. 428Clear all enabled permissions.
429This is useful for clearing the default set of permissions so permissions may 429This is useful for clearing the default set of permissions so permissions may
430be added individually. 430be added individually.
431.Pp
432.It Ic critical : Ns Ar name Ns Op Ns = Ns Ar contents
433.It Ic extension : Ns Ar name Ns Op Ns = Ns Ar contents
434Includes an arbitrary certificate critical option or extension.
435The specified
436.Ar name
437should include a domain suffix, e.g.\&
438.Dq name@example.com .
439If
440.Ar contents
441is specified then it is included as the contents of the extension/option
442encoded as a string, otherwise the extension/option is created with no
443contents (usually indicating a flag).
444Extensions may be ignored by a client or server that does not recognise them,
445whereas unknown critical options will cause the certificate to be refused.
446.Pp
447At present, no standard options are valid for host keys.
448.Pp
431.It Ic force-command Ns = Ns Ar command 449.It Ic force-command Ns = Ns Ar command
432Forces the execution of 450Forces the execution of
433.Ar command 451.Ar command
434instead of any shell or command specified by the user when 452instead of any shell or command specified by the user when
435the certificate is used for authentication. 453the certificate is used for authentication.
454.Pp
436.It Ic no-agent-forwarding 455.It Ic no-agent-forwarding
437Disable 456Disable
438.Xr ssh-agent 1 457.Xr ssh-agent 1
439forwarding (permitted by default). 458forwarding (permitted by default).
459.Pp
440.It Ic no-port-forwarding 460.It Ic no-port-forwarding
441Disable port forwarding (permitted by default). 461Disable port forwarding (permitted by default).
462.Pp
442.It Ic no-pty 463.It Ic no-pty
443Disable PTY allocation (permitted by default). 464Disable PTY allocation (permitted by default).
465.Pp
444.It Ic no-user-rc 466.It Ic no-user-rc
445Disable execution of 467Disable execution of
446.Pa ~/.ssh/rc 468.Pa ~/.ssh/rc
447by 469by
448.Xr sshd 8 470.Xr sshd 8
449(permitted by default). 471(permitted by default).
472.Pp
450.It Ic no-x11-forwarding 473.It Ic no-x11-forwarding
451Disable X11 forwarding (permitted by default). 474Disable X11 forwarding (permitted by default).
475.Pp
452.It Ic permit-agent-forwarding 476.It Ic permit-agent-forwarding
453Allows 477Allows
454.Xr ssh-agent 1 478.Xr ssh-agent 1
455forwarding. 479forwarding.
480.Pp
456.It Ic permit-port-forwarding 481.It Ic permit-port-forwarding
457Allows port forwarding. 482Allows port forwarding.
483.Pp
458.It Ic permit-pty 484.It Ic permit-pty
459Allows PTY allocation. 485Allows PTY allocation.
486.Pp
460.It Ic permit-user-rc 487.It Ic permit-user-rc
461Allows execution of 488Allows execution of
462.Pa ~/.ssh/rc 489.Pa ~/.ssh/rc
463by 490by
464.Xr sshd 8 . 491.Xr sshd 8 .
492.Pp
465.It Ic permit-x11-forwarding 493.It Ic permit-x11-forwarding
466Allows X11 forwarding. 494Allows X11 forwarding.
495.Pp
467.It Ic source-address Ns = Ns Ar address_list 496.It Ic source-address Ns = Ns Ar address_list
468Restrict the source addresses from which the certificate is considered valid. 497Restrict the source addresses from which the certificate is considered valid.
469The 498The
@@ -471,8 +500,6 @@ The
471is a comma-separated list of one or more address/netmask pairs in CIDR 500is a comma-separated list of one or more address/netmask pairs in CIDR
472format. 501format.
473.El 502.El
474.Pp
475At present, no options are valid for host keys.
476.It Fl o 503.It Fl o
477Causes 504Causes
478.Nm 505.Nm
@@ -526,17 +553,22 @@ section for details.
526Test DH group exchange candidate primes (generated using the 553Test DH group exchange candidate primes (generated using the
527.Fl G 554.Fl G
528option) for safety. 555option) for safety.
529.It Fl t Cm dsa | ecdsa | ed25519 | rsa | rsa1 556.It Fl t Cm dsa | ecdsa | ed25519 | rsa
530Specifies the type of key to create. 557Specifies the type of key to create.
531The possible values are 558The possible values are
532.Dq rsa1
533for protocol version 1 and
534.Dq dsa , 559.Dq dsa ,
535.Dq ecdsa , 560.Dq ecdsa ,
536.Dq ed25519 , 561.Dq ed25519 ,
537or 562or
538.Dq rsa 563.Dq rsa .
539for protocol version 2. 564.It Fl U
565When used in combination with
566.Fl s ,
567this option indicates that a CA key resides in a
568.Xr ssh-agent 1 .
569See the
570.Sx CERTIFICATES
571section for more information.
540.It Fl u 572.It Fl u
541Update a KRL. 573Update a KRL.
542When specified with 574When specified with
@@ -684,6 +716,14 @@ to
684.Pp 716.Pp
685.Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub 717.Dl $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id user_key.pub
686.Pp 718.Pp
719Similarly, it is possible for the CA key to be hosted in a
720.Xr ssh-agent 1 .
721This is indicated by the
722.Fl U
723flag and, again, the CA key must be identified by its public half.
724.Pp
725.Dl $ ssh-keygen -Us ca_key.pub -I key_id user_key.pub
726.Pp
687In all cases, 727In all cases,
688.Ar key_id 728.Ar key_id
689is a "key identifier" that is logged by the server when the certificate 729is a "key identifier" that is logged by the server when the certificate
@@ -791,31 +831,11 @@ will exit with a non-zero exit status.
791A zero exit status will only be returned if no key was revoked. 831A zero exit status will only be returned if no key was revoked.
792.Sh FILES 832.Sh FILES
793.Bl -tag -width Ds -compact 833.Bl -tag -width Ds -compact
794.It Pa ~/.ssh/identity
795Contains the protocol version 1 RSA authentication identity of the user.
796This file should not be readable by anyone but the user.
797It is possible to
798specify a passphrase when generating the key; that passphrase will be
799used to encrypt the private part of this file using 3DES.
800This file is not automatically accessed by
801.Nm
802but it is offered as the default file for the private key.
803.Xr ssh 1
804will read this file when a login attempt is made.
805.Pp
806.It Pa ~/.ssh/identity.pub
807Contains the protocol version 1 RSA public key for authentication.
808The contents of this file should be added to
809.Pa ~/.ssh/authorized_keys
810on all machines
811where the user wishes to log in using RSA authentication.
812There is no need to keep the contents of this file secret.
813.Pp
814.It Pa ~/.ssh/id_dsa 834.It Pa ~/.ssh/id_dsa
815.It Pa ~/.ssh/id_ecdsa 835.It Pa ~/.ssh/id_ecdsa
816.It Pa ~/.ssh/id_ed25519 836.It Pa ~/.ssh/id_ed25519
817.It Pa ~/.ssh/id_rsa 837.It Pa ~/.ssh/id_rsa
818Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA 838Contains the DSA, ECDSA, Ed25519 or RSA
819authentication identity of the user. 839authentication identity of the user.
820This file should not be readable by anyone but the user. 840This file should not be readable by anyone but the user.
821It is possible to 841It is possible to
@@ -831,7 +851,7 @@ will read this file when a login attempt is made.
831.It Pa ~/.ssh/id_ecdsa.pub 851.It Pa ~/.ssh/id_ecdsa.pub
832.It Pa ~/.ssh/id_ed25519.pub 852.It Pa ~/.ssh/id_ed25519.pub
833.It Pa ~/.ssh/id_rsa.pub 853.It Pa ~/.ssh/id_rsa.pub
834Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA 854Contains the DSA, ECDSA, Ed25519 or RSA
835public key for authentication. 855public key for authentication.
836The contents of this file should be added to 856The contents of this file should be added to
837.Pa ~/.ssh/authorized_keys 857.Pa ~/.ssh/authorized_keys