1*8ad9b54aSDag-Erling Smørgrav.\" $OpenBSD: ssh-keygen.1,v 1.92 2010/03/13 23:38:13 jmc Exp $ 2cce7d346SDag-Erling Smørgrav.\" $FreeBSD$ 31e8db6e2SBrian Feldman.\" 4511b41d2SMark Murray.\" -*- nroff -*- 5511b41d2SMark Murray.\" 6511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 7511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 8511b41d2SMark Murray.\" All rights reserved 9511b41d2SMark Murray.\" 10b66f2d16SKris Kennaway.\" As far as I am concerned, the code I have written for this software 11b66f2d16SKris Kennaway.\" can be used freely for any purpose. Any derived versions of this 12b66f2d16SKris Kennaway.\" software must be clearly marked as such, and if the derived work is 13b66f2d16SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be 14b66f2d16SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell". 15511b41d2SMark Murray.\" 16b66f2d16SKris Kennaway.\" 17b66f2d16SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 18b66f2d16SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 19b66f2d16SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 20b66f2d16SKris Kennaway.\" 21b66f2d16SKris Kennaway.\" Redistribution and use in source and binary forms, with or without 22b66f2d16SKris Kennaway.\" modification, are permitted provided that the following conditions 23b66f2d16SKris Kennaway.\" are met: 24b66f2d16SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright 25b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer. 26b66f2d16SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright 27b66f2d16SKris Kennaway.\" notice, this list of conditions and the following disclaimer in the 28b66f2d16SKris Kennaway.\" documentation and/or other materials provided with the distribution. 29b66f2d16SKris Kennaway.\" 30b66f2d16SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 31b66f2d16SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 32b66f2d16SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 33b66f2d16SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 34b66f2d16SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 35b66f2d16SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36b66f2d16SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37b66f2d16SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38b66f2d16SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39b66f2d16SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40511b41d2SMark Murray.\" 41*8ad9b54aSDag-Erling Smørgrav.Dd March 13 2010 42511b41d2SMark Murray.Dt SSH-KEYGEN 1 43511b41d2SMark Murray.Os 44511b41d2SMark Murray.Sh NAME 45511b41d2SMark Murray.Nm ssh-keygen 461e8db6e2SBrian Feldman.Nd authentication key generation, management and conversion 47511b41d2SMark Murray.Sh SYNOPSIS 48511b41d2SMark Murray.Nm ssh-keygen 49d0c8c0bcSDag-Erling Smørgrav.Bk -words 501e8db6e2SBrian Feldman.Op Fl q 51511b41d2SMark Murray.Op Fl b Ar bits 52ae1f160dSDag-Erling Smørgrav.Fl t Ar type 53511b41d2SMark Murray.Op Fl N Ar new_passphrase 54511b41d2SMark Murray.Op Fl C Ar comment 55b66f2d16SKris Kennaway.Op Fl f Ar output_keyfile 56511b41d2SMark Murray.Nm ssh-keygen 57511b41d2SMark Murray.Fl p 58511b41d2SMark Murray.Op Fl P Ar old_passphrase 59511b41d2SMark Murray.Op Fl N Ar new_passphrase 60511b41d2SMark Murray.Op Fl f Ar keyfile 61511b41d2SMark Murray.Nm ssh-keygen 621e8db6e2SBrian Feldman.Fl i 63b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 64a04a10f8SKris Kennaway.Nm ssh-keygen 651e8db6e2SBrian Feldman.Fl e 66b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 67a04a10f8SKris Kennaway.Nm ssh-keygen 68a04a10f8SKris Kennaway.Fl y 69b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 70a04a10f8SKris Kennaway.Nm ssh-keygen 71511b41d2SMark Murray.Fl c 72511b41d2SMark Murray.Op Fl P Ar passphrase 73511b41d2SMark Murray.Op Fl C Ar comment 74511b41d2SMark Murray.Op Fl f Ar keyfile 75511b41d2SMark Murray.Nm ssh-keygen 76511b41d2SMark Murray.Fl l 77b66f2d16SKris Kennaway.Op Fl f Ar input_keyfile 78a04a10f8SKris Kennaway.Nm ssh-keygen 791e8db6e2SBrian Feldman.Fl B 801e8db6e2SBrian Feldman.Op Fl f Ar input_keyfile 81ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen 82b15c8340SDag-Erling Smørgrav.Fl D Ar pkcs11 83ae1f160dSDag-Erling Smørgrav.Nm ssh-keygen 845e8dbd04SDag-Erling Smørgrav.Fl F Ar hostname 855e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file 86cce7d346SDag-Erling Smørgrav.Op Fl l 875e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen 885e8dbd04SDag-Erling Smørgrav.Fl H 895e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file 905e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen 915e8dbd04SDag-Erling Smørgrav.Fl R Ar hostname 925e8dbd04SDag-Erling Smørgrav.Op Fl f Ar known_hosts_file 935e8dbd04SDag-Erling Smørgrav.Nm ssh-keygen 94d95e11bfSDag-Erling Smørgrav.Fl r Ar hostname 95d95e11bfSDag-Erling Smørgrav.Op Fl f Ar input_keyfile 96d95e11bfSDag-Erling Smørgrav.Op Fl g 97d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen 98d95e11bfSDag-Erling Smørgrav.Fl G Ar output_file 99efcad6b7SDag-Erling Smørgrav.Op Fl v 100d95e11bfSDag-Erling Smørgrav.Op Fl b Ar bits 101d95e11bfSDag-Erling Smørgrav.Op Fl M Ar memory 102d95e11bfSDag-Erling Smørgrav.Op Fl S Ar start_point 103d95e11bfSDag-Erling Smørgrav.Nm ssh-keygen 104d95e11bfSDag-Erling Smørgrav.Fl T Ar output_file 105d95e11bfSDag-Erling Smørgrav.Fl f Ar input_file 106efcad6b7SDag-Erling Smørgrav.Op Fl v 107d95e11bfSDag-Erling Smørgrav.Op Fl a Ar num_trials 108d95e11bfSDag-Erling Smørgrav.Op Fl W Ar generator 109b15c8340SDag-Erling Smørgrav.Nm ssh-keygen 110b15c8340SDag-Erling Smørgrav.Fl s Ar ca_key 111b15c8340SDag-Erling Smørgrav.Fl I Ar certificate_identity 112b15c8340SDag-Erling Smørgrav.Op Fl h 113b15c8340SDag-Erling Smørgrav.Op Fl n Ar principals 114b15c8340SDag-Erling Smørgrav.Op Fl O Ar constraint 115b15c8340SDag-Erling Smørgrav.Op Fl V Ar validity_interval 116b15c8340SDag-Erling Smørgrav.Ar 117b15c8340SDag-Erling Smørgrav.Nm ssh-keygen 118b15c8340SDag-Erling Smørgrav.Fl L 119b15c8340SDag-Erling Smørgrav.Op Fl f Ar input_keyfile 120b15c8340SDag-Erling Smørgrav.Ek 121511b41d2SMark Murray.Sh DESCRIPTION 122511b41d2SMark Murray.Nm 1231e8db6e2SBrian Feldmangenerates, manages and converts authentication keys for 124511b41d2SMark Murray.Xr ssh 1 . 125a04a10f8SKris Kennaway.Nm 126ae1f160dSDag-Erling Smørgravcan create RSA keys for use by SSH protocol version 1 and RSA or DSA 127d95e11bfSDag-Erling Smørgravkeys for use by SSH protocol version 2. 128d95e11bfSDag-Erling SmørgravThe type of key to be generated is specified with the 1291e8db6e2SBrian Feldman.Fl t 130ae1f160dSDag-Erling Smørgravoption. 131021d409fSDag-Erling SmørgravIf invoked without any arguments, 132021d409fSDag-Erling Smørgrav.Nm 133021d409fSDag-Erling Smørgravwill generate an RSA key for use in SSH protocol 2 connections. 134a04a10f8SKris Kennaway.Pp 135d95e11bfSDag-Erling Smørgrav.Nm 136d95e11bfSDag-Erling Smørgravis also used to generate groups for use in Diffie-Hellman group 137d95e11bfSDag-Erling Smørgravexchange (DH-GEX). 138d95e11bfSDag-Erling SmørgravSee the 139d95e11bfSDag-Erling Smørgrav.Sx MODULI GENERATION 140d95e11bfSDag-Erling Smørgravsection for details. 141d95e11bfSDag-Erling Smørgrav.Pp 142511b41d2SMark MurrayNormally each user wishing to use SSH 143a04a10f8SKris Kennawaywith RSA or DSA authentication runs this once to create the authentication 144511b41d2SMark Murraykey in 145043840dfSDag-Erling Smørgrav.Pa ~/.ssh/identity , 146043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_dsa 147a04a10f8SKris Kennawayor 148043840dfSDag-Erling Smørgrav.Pa ~/.ssh/id_rsa . 149a04a10f8SKris KennawayAdditionally, the system administrator may use this to generate host keys, 150a04a10f8SKris Kennawayas seen in 151a04a10f8SKris Kennaway.Pa /etc/rc . 152511b41d2SMark Murray.Pp 153511b41d2SMark MurrayNormally this program generates the key and asks for a file in which 154a8f6863aSKris Kennawayto store the private key. 155a8f6863aSKris KennawayThe public key is stored in a file with the same name but 156511b41d2SMark Murray.Dq .pub 157a8f6863aSKris Kennawayappended. 158a8f6863aSKris KennawayThe program also asks for a passphrase. 159a8f6863aSKris KennawayThe passphrase may be empty to indicate no passphrase 1601e8db6e2SBrian Feldman(host keys must have an empty passphrase), or it may be a string of 161a8f6863aSKris Kennawayarbitrary length. 162ae1f160dSDag-Erling SmørgravA passphrase is similar to a password, except it can be a phrase with a 163ae1f160dSDag-Erling Smørgravseries of words, punctuation, numbers, whitespace, or any string of 164ae1f160dSDag-Erling Smørgravcharacters you want. 165ae1f160dSDag-Erling SmørgravGood passphrases are 10-30 characters long, are 166511b41d2SMark Murraynot simple sentences or otherwise easily guessable (English 167ae1f160dSDag-Erling Smørgravprose has only 1-2 bits of entropy per character, and provides very bad 168ae1f160dSDag-Erling Smørgravpassphrases), and contain a mix of upper and lowercase letters, 169ae1f160dSDag-Erling Smørgravnumbers, and non-alphanumeric characters. 170a8f6863aSKris KennawayThe passphrase can be changed later by using the 171511b41d2SMark Murray.Fl p 172511b41d2SMark Murrayoption. 173511b41d2SMark Murray.Pp 174a8f6863aSKris KennawayThere is no way to recover a lost passphrase. 175a8f6863aSKris KennawayIf the passphrase is 176ae1f160dSDag-Erling Smørgravlost or forgotten, a new key must be generated and copied to the 177511b41d2SMark Murraycorresponding public key to other machines. 178511b41d2SMark Murray.Pp 1791e8db6e2SBrian FeldmanFor RSA1 keys, 1801e8db6e2SBrian Feldmanthere is also a comment field in the key file that is only for 181a8f6863aSKris Kennawayconvenience to the user to help identify the key. 182a8f6863aSKris KennawayThe comment can tell what the key is for, or whatever is useful. 183a8f6863aSKris KennawayThe comment is initialized to 184511b41d2SMark Murray.Dq user@host 185511b41d2SMark Murraywhen the key is created, but can be changed using the 186511b41d2SMark Murray.Fl c 187511b41d2SMark Murrayoption. 188511b41d2SMark Murray.Pp 189a04a10f8SKris KennawayAfter a key is generated, instructions below detail where the keys 190a04a10f8SKris Kennawayshould be placed to be activated. 191a04a10f8SKris Kennaway.Pp 192511b41d2SMark MurrayThe options are as follows: 193511b41d2SMark Murray.Bl -tag -width Ds 194d95e11bfSDag-Erling Smørgrav.It Fl a Ar trials 195d95e11bfSDag-Erling SmørgravSpecifies the number of primality tests to perform when screening DH-GEX 196d95e11bfSDag-Erling Smørgravcandidates using the 197d95e11bfSDag-Erling Smørgrav.Fl T 198d95e11bfSDag-Erling Smørgravcommand. 1995e8dbd04SDag-Erling Smørgrav.It Fl B 2005e8dbd04SDag-Erling SmørgravShow the bubblebabble digest of specified private or public key file. 201511b41d2SMark Murray.It Fl b Ar bits 202a8f6863aSKris KennawaySpecifies the number of bits in the key to create. 203021d409fSDag-Erling SmørgravFor RSA keys, the minimum size is 768 bits and the default is 2048 bits. 204043840dfSDag-Erling SmørgravGenerally, 2048 bits is considered sufficient. 205021d409fSDag-Erling SmørgravDSA keys must be exactly 1024 bits as specified by FIPS 186-2. 2065e8dbd04SDag-Erling Smørgrav.It Fl C Ar comment 2075e8dbd04SDag-Erling SmørgravProvides a new comment. 208511b41d2SMark Murray.It Fl c 209511b41d2SMark MurrayRequests changing the comment in the private and public key files. 210ae1f160dSDag-Erling SmørgravThis operation is only supported for RSA1 keys. 211511b41d2SMark MurrayThe program will prompt for the file containing the private keys, for 212ae1f160dSDag-Erling Smørgravthe passphrase if the key has one, and for the new comment. 213b15c8340SDag-Erling Smørgrav.It Fl D Ar pkcs11 214b15c8340SDag-Erling SmørgravDownload the RSA public keys provided by the PKCS#11 shared library 215b15c8340SDag-Erling Smørgrav.Ar pkcs11 . 2161e8db6e2SBrian Feldman.It Fl e 2171e8db6e2SBrian FeldmanThis option will read a private or public OpenSSH key file and 218d4af9e69SDag-Erling Smørgravprint the key in 219d4af9e69SDag-Erling SmørgravRFC 4716 SSH Public Key File Format 2201e8db6e2SBrian Feldmanto stdout. 2211e8db6e2SBrian FeldmanThis option allows exporting keys for use by several commercial 2221e8db6e2SBrian FeldmanSSH implementations. 2235e8dbd04SDag-Erling Smørgrav.It Fl F Ar hostname 2245e8dbd04SDag-Erling SmørgravSearch for the specified 2255e8dbd04SDag-Erling Smørgrav.Ar hostname 2265e8dbd04SDag-Erling Smørgravin a 2275e8dbd04SDag-Erling Smørgrav.Pa known_hosts 2285e8dbd04SDag-Erling Smørgravfile, listing any occurrences found. 2295e8dbd04SDag-Erling SmørgravThis option is useful to find hashed host names or addresses and may also be 2305e8dbd04SDag-Erling Smørgravused in conjunction with the 2315e8dbd04SDag-Erling Smørgrav.Fl H 2325e8dbd04SDag-Erling Smørgravoption to print found keys in a hashed format. 2335e8dbd04SDag-Erling Smørgrav.It Fl f Ar filename 2345e8dbd04SDag-Erling SmørgravSpecifies the filename of the key file. 2355e8dbd04SDag-Erling Smørgrav.It Fl G Ar output_file 2365e8dbd04SDag-Erling SmørgravGenerate candidate primes for DH-GEX. 2375e8dbd04SDag-Erling SmørgravThese primes must be screened for 2385e8dbd04SDag-Erling Smørgravsafety (using the 2395e8dbd04SDag-Erling Smørgrav.Fl T 2405e8dbd04SDag-Erling Smørgravoption) before use. 241d95e11bfSDag-Erling Smørgrav.It Fl g 242d74d50a8SDag-Erling SmørgravUse generic DNS format when printing fingerprint resource records using the 243d74d50a8SDag-Erling Smørgrav.Fl r 244d74d50a8SDag-Erling Smørgravcommand. 2455e8dbd04SDag-Erling Smørgrav.It Fl H 2465e8dbd04SDag-Erling SmørgravHash a 2475e8dbd04SDag-Erling Smørgrav.Pa known_hosts 2484518870cSDag-Erling Smørgravfile. 2494518870cSDag-Erling SmørgravThis replaces all hostnames and addresses with hashed representations 2504518870cSDag-Erling Smørgravwithin the specified file; the original content is moved to a file with 2514518870cSDag-Erling Smørgrava .old suffix. 2525e8dbd04SDag-Erling SmørgravThese hashes may be used normally by 2535e8dbd04SDag-Erling Smørgrav.Nm ssh 2545e8dbd04SDag-Erling Smørgravand 2555e8dbd04SDag-Erling Smørgrav.Nm sshd , 2565e8dbd04SDag-Erling Smørgravbut they do not reveal identifying information should the file's contents 2575e8dbd04SDag-Erling Smørgravbe disclosed. 2585e8dbd04SDag-Erling SmørgravThis option will not modify existing hashed hostnames and is therefore safe 2595e8dbd04SDag-Erling Smørgravto use on files that mix hashed and non-hashed names. 260b15c8340SDag-Erling Smørgrav.It Fl h 261b15c8340SDag-Erling SmørgravWhen signing a key, create a host certificate instead of a user 262b15c8340SDag-Erling Smørgravcertificate. 263b15c8340SDag-Erling SmørgravPlease see the 264b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES 265b15c8340SDag-Erling Smørgravsection for details. 266b15c8340SDag-Erling Smørgrav.It Fl I Ar certificate_identity 267b15c8340SDag-Erling SmørgravSpecify the key identity when signing a public key. 268b15c8340SDag-Erling SmørgravPlease see the 269b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES 270b15c8340SDag-Erling Smørgravsection for details. 2711e8db6e2SBrian Feldman.It Fl i 2721e8db6e2SBrian FeldmanThis option will read an unencrypted private (or public) key file 2731e8db6e2SBrian Feldmanin SSH2-compatible format and print an OpenSSH compatible private 2741e8db6e2SBrian Feldman(or public) key to stdout. 2751e8db6e2SBrian Feldman.Nm 2761e8db6e2SBrian Feldmanalso reads the 277d4af9e69SDag-Erling SmørgravRFC 4716 SSH Public Key File Format. 2781e8db6e2SBrian FeldmanThis option allows importing keys from several commercial 2791e8db6e2SBrian FeldmanSSH implementations. 280b15c8340SDag-Erling Smørgrav.It Fl L 281b15c8340SDag-Erling SmørgravPrints the contents of a certificate. 282511b41d2SMark Murray.It Fl l 283ae1f160dSDag-Erling SmørgravShow fingerprint of specified public key file. 284ae1f160dSDag-Erling SmørgravPrivate RSA1 keys are also supported. 285ae1f160dSDag-Erling SmørgravFor RSA and DSA keys 286ae1f160dSDag-Erling Smørgrav.Nm 287ae1f160dSDag-Erling Smørgravtries to find the matching public key file and prints its fingerprint. 288d4af9e69SDag-Erling SmørgravIf combined with 289d4af9e69SDag-Erling Smørgrav.Fl v , 290d4af9e69SDag-Erling Smørgravan ASCII art representation of the key is supplied with the fingerprint. 2915e8dbd04SDag-Erling Smørgrav.It Fl M Ar memory 2925e8dbd04SDag-Erling SmørgravSpecify the amount of memory to use (in megabytes) when generating 2935e8dbd04SDag-Erling Smørgravcandidate moduli for DH-GEX. 2945e8dbd04SDag-Erling Smørgrav.It Fl N Ar new_passphrase 2955e8dbd04SDag-Erling SmørgravProvides the new passphrase. 296b15c8340SDag-Erling Smørgrav.It Fl n Ar principals 297b15c8340SDag-Erling SmørgravSpecify one or more principals (user or host names) to be included in 298b15c8340SDag-Erling Smørgrava certificate when signing a key. 299b15c8340SDag-Erling SmørgravMultiple principals may be specified, separated by commas. 300b15c8340SDag-Erling SmørgravPlease see the 301b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES 302b15c8340SDag-Erling Smørgravsection for details. 303b15c8340SDag-Erling Smørgrav.It Fl O Ar constraint 304b15c8340SDag-Erling SmørgravSpecify a certificate constraint when signing a key. 305b15c8340SDag-Erling SmørgravThis option may be specified multiple times. 306b15c8340SDag-Erling SmørgravPlease see the 307b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES 308b15c8340SDag-Erling Smørgravsection for details. 309b15c8340SDag-Erling SmørgravThe constraints that are valid for user certificates are: 310b15c8340SDag-Erling Smørgrav.Bl -tag -width Ds 311*8ad9b54aSDag-Erling Smørgrav.It Ic clear 312*8ad9b54aSDag-Erling SmørgravClear all enabled permissions. 313*8ad9b54aSDag-Erling SmørgravThis is useful for clearing the default set of permissions so permissions may 314*8ad9b54aSDag-Erling Smørgravbe added individually. 315*8ad9b54aSDag-Erling Smørgrav.It Ic force-command Ns = Ns Ar command 316*8ad9b54aSDag-Erling SmørgravForces the execution of 317*8ad9b54aSDag-Erling Smørgrav.Ar command 318*8ad9b54aSDag-Erling Smørgravinstead of any shell or command specified by the user when 319*8ad9b54aSDag-Erling Smørgravthe certificate is used for authentication. 320b15c8340SDag-Erling Smørgrav.It Ic no-agent-forwarding 321b15c8340SDag-Erling SmørgravDisable 322b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1 323b15c8340SDag-Erling Smørgravforwarding (permitted by default). 324b15c8340SDag-Erling Smørgrav.It Ic no-port-forwarding 325b15c8340SDag-Erling SmørgravDisable port forwarding (permitted by default). 326b15c8340SDag-Erling Smørgrav.It Ic no-pty 327b15c8340SDag-Erling SmørgravDisable PTY allocation (permitted by default). 328b15c8340SDag-Erling Smørgrav.It Ic no-user-rc 329b15c8340SDag-Erling SmørgravDisable execution of 330b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc 331b15c8340SDag-Erling Smørgravby 332b15c8340SDag-Erling Smørgrav.Xr sshd 8 333b15c8340SDag-Erling Smørgrav(permitted by default). 334*8ad9b54aSDag-Erling Smørgrav.It Ic no-x11-forwarding 335*8ad9b54aSDag-Erling SmørgravDisable X11 forwarding (permitted by default). 336b15c8340SDag-Erling Smørgrav.It Ic permit-agent-forwarding 337b15c8340SDag-Erling SmørgravAllows 338b15c8340SDag-Erling Smørgrav.Xr ssh-agent 1 339b15c8340SDag-Erling Smørgravforwarding. 340b15c8340SDag-Erling Smørgrav.It Ic permit-port-forwarding 341b15c8340SDag-Erling SmørgravAllows port forwarding. 342b15c8340SDag-Erling Smørgrav.It Ic permit-pty 343b15c8340SDag-Erling SmørgravAllows PTY allocation. 344b15c8340SDag-Erling Smørgrav.It Ic permit-user-rc 345b15c8340SDag-Erling SmørgravAllows execution of 346b15c8340SDag-Erling Smørgrav.Pa ~/.ssh/rc 347b15c8340SDag-Erling Smørgravby 348b15c8340SDag-Erling Smørgrav.Xr sshd 8 . 349*8ad9b54aSDag-Erling Smørgrav.It Ic permit-x11-forwarding 350*8ad9b54aSDag-Erling SmørgravAllows X11 forwarding. 351*8ad9b54aSDag-Erling Smørgrav.It Ic source-address Ns = Ns Ar address_list 352*8ad9b54aSDag-Erling SmørgravRestrict the source addresses from which the certificate is considered valid. 353b15c8340SDag-Erling SmørgravThe 354b15c8340SDag-Erling Smørgrav.Ar address_list 355b15c8340SDag-Erling Smørgravis a comma-separated list of one or more address/netmask pairs in CIDR 356b15c8340SDag-Erling Smørgravformat. 357b15c8340SDag-Erling Smørgrav.El 358b15c8340SDag-Erling Smørgrav.Pp 359b15c8340SDag-Erling SmørgravAt present, no constraints are valid for host keys. 3605e8dbd04SDag-Erling Smørgrav.It Fl P Ar passphrase 3615e8dbd04SDag-Erling SmørgravProvides the (old) passphrase. 362511b41d2SMark Murray.It Fl p 363511b41d2SMark MurrayRequests changing the passphrase of a private key file instead of 364a8f6863aSKris Kennawaycreating a new private key. 365a8f6863aSKris KennawayThe program will prompt for the file 366511b41d2SMark Murraycontaining the private key, for the old passphrase, and twice for the 367511b41d2SMark Murraynew passphrase. 368511b41d2SMark Murray.It Fl q 369511b41d2SMark MurraySilence 370511b41d2SMark Murray.Nm ssh-keygen . 371511b41d2SMark MurrayUsed by 372511b41d2SMark Murray.Pa /etc/rc 373511b41d2SMark Murraywhen creating a new key. 3745e8dbd04SDag-Erling Smørgrav.It Fl R Ar hostname 3755e8dbd04SDag-Erling SmørgravRemoves all keys belonging to 3765e8dbd04SDag-Erling Smørgrav.Ar hostname 3775e8dbd04SDag-Erling Smørgravfrom a 3785e8dbd04SDag-Erling Smørgrav.Pa known_hosts 3795e8dbd04SDag-Erling Smørgravfile. 3805e8dbd04SDag-Erling SmørgravThis option is useful to delete hashed hosts (see the 3815e8dbd04SDag-Erling Smørgrav.Fl H 3825e8dbd04SDag-Erling Smørgravoption above). 3835e8dbd04SDag-Erling Smørgrav.It Fl r Ar hostname 3845e8dbd04SDag-Erling SmørgravPrint the SSHFP fingerprint resource record named 3855e8dbd04SDag-Erling Smørgrav.Ar hostname 3865e8dbd04SDag-Erling Smørgravfor the specified public key file. 3875e8dbd04SDag-Erling Smørgrav.It Fl S Ar start 3885e8dbd04SDag-Erling SmørgravSpecify start point (in hex) when generating candidate moduli for DH-GEX. 389b15c8340SDag-Erling Smørgrav.It Fl s Ar ca_key 390b15c8340SDag-Erling SmørgravCertify (sign) a public key using the specified CA key. 391b15c8340SDag-Erling SmørgravPlease see the 392b15c8340SDag-Erling Smørgrav.Sx CERTIFICATES 393b15c8340SDag-Erling Smørgravsection for details. 3945e8dbd04SDag-Erling Smørgrav.It Fl T Ar output_file 3955e8dbd04SDag-Erling SmørgravTest DH group exchange candidate primes (generated using the 3965e8dbd04SDag-Erling Smørgrav.Fl G 3975e8dbd04SDag-Erling Smørgravoption) for safety. 3981e8db6e2SBrian Feldman.It Fl t Ar type 3995e8dbd04SDag-Erling SmørgravSpecifies the type of key to create. 4001e8db6e2SBrian FeldmanThe possible values are 4011e8db6e2SBrian Feldman.Dq rsa1 4021e8db6e2SBrian Feldmanfor protocol version 1 and 4031e8db6e2SBrian Feldman.Dq rsa 4041e8db6e2SBrian Feldmanor 4051e8db6e2SBrian Feldman.Dq dsa 4061e8db6e2SBrian Feldmanfor protocol version 2. 407b15c8340SDag-Erling Smørgrav.It Fl V Ar validity_interval 408b15c8340SDag-Erling SmørgravSpecify a validity interval when signing a certificate. 409b15c8340SDag-Erling SmørgravA validity interval may consist of a single time, indicating that the 410b15c8340SDag-Erling Smørgravcertificate is valid beginning now and expiring at that time, or may consist 411b15c8340SDag-Erling Smørgravof two times separated by a colon to indicate an explicit time interval. 412b15c8340SDag-Erling SmørgravThe start time may be specified as a date in YYYYMMDD format, a time 413b15c8340SDag-Erling Smørgravin YYYYMMDDHHMMSS format or a relative time (to the current time) consisting 414b15c8340SDag-Erling Smørgravof a minus sign followed by a relative time in the format described in the 415b15c8340SDag-Erling Smørgrav.Sx TIME FORMATS 416b15c8340SDag-Erling Smørgravsection of 417*8ad9b54aSDag-Erling Smørgrav.Xr sshd_config 5 . 418b15c8340SDag-Erling SmørgravThe end time may be specified as a YYYYMMDD date, a YYYYMMDDHHMMSS time or 419b15c8340SDag-Erling Smørgrava relative time starting with a plus character. 420b15c8340SDag-Erling Smørgrav.Pp 421b15c8340SDag-Erling SmørgravFor example: 422b15c8340SDag-Erling Smørgrav.Dq +52w1d 423b15c8340SDag-Erling Smørgrav(valid from now to 52 weeks and one day from now), 424b15c8340SDag-Erling Smørgrav.Dq -4w:+4w 425b15c8340SDag-Erling Smørgrav(valid from four weeks ago to four weeks from now), 426b15c8340SDag-Erling Smørgrav.Dq 20100101123000:20110101123000 427b15c8340SDag-Erling Smørgrav(valid from 12:30 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011), 428b15c8340SDag-Erling Smørgrav.Dq -1d:20110101 429b15c8340SDag-Erling Smørgrav(valid from yesterday to midnight, January 1st, 2011). 430efcad6b7SDag-Erling Smørgrav.It Fl v 431efcad6b7SDag-Erling SmørgravVerbose mode. 432efcad6b7SDag-Erling SmørgravCauses 433efcad6b7SDag-Erling Smørgrav.Nm 434efcad6b7SDag-Erling Smørgravto print debugging messages about its progress. 435efcad6b7SDag-Erling SmørgravThis is helpful for debugging moduli generation. 436efcad6b7SDag-Erling SmørgravMultiple 437efcad6b7SDag-Erling Smørgrav.Fl v 438efcad6b7SDag-Erling Smørgravoptions increase the verbosity. 439efcad6b7SDag-Erling SmørgravThe maximum is 3. 4405e8dbd04SDag-Erling Smørgrav.It Fl W Ar generator 4415e8dbd04SDag-Erling SmørgravSpecify desired generator when testing candidate moduli for DH-GEX. 4425e8dbd04SDag-Erling Smørgrav.It Fl y 4435e8dbd04SDag-Erling SmørgravThis option will read a private 4445e8dbd04SDag-Erling SmørgravOpenSSH format file and print an OpenSSH public key to stdout. 445511b41d2SMark Murray.El 446d95e11bfSDag-Erling Smørgrav.Sh MODULI GENERATION 447d95e11bfSDag-Erling Smørgrav.Nm 448d95e11bfSDag-Erling Smørgravmay be used to generate groups for the Diffie-Hellman Group Exchange 449d95e11bfSDag-Erling Smørgrav(DH-GEX) protocol. 450d95e11bfSDag-Erling SmørgravGenerating these groups is a two-step process: first, candidate 451d95e11bfSDag-Erling Smørgravprimes are generated using a fast, but memory intensive process. 452d95e11bfSDag-Erling SmørgravThese candidate primes are then tested for suitability (a CPU-intensive 453d95e11bfSDag-Erling Smørgravprocess). 454d95e11bfSDag-Erling Smørgrav.Pp 455d95e11bfSDag-Erling SmørgravGeneration of primes is performed using the 456d95e11bfSDag-Erling Smørgrav.Fl G 457d95e11bfSDag-Erling Smørgravoption. 458d95e11bfSDag-Erling SmørgravThe desired length of the primes may be specified by the 459d95e11bfSDag-Erling Smørgrav.Fl b 460d95e11bfSDag-Erling Smørgravoption. 461d95e11bfSDag-Erling SmørgravFor example: 462d95e11bfSDag-Erling Smørgrav.Pp 4635e8dbd04SDag-Erling Smørgrav.Dl # ssh-keygen -G moduli-2048.candidates -b 2048 464d95e11bfSDag-Erling Smørgrav.Pp 465d95e11bfSDag-Erling SmørgravBy default, the search for primes begins at a random point in the 466d95e11bfSDag-Erling Smørgravdesired length range. 467d95e11bfSDag-Erling SmørgravThis may be overridden using the 468d95e11bfSDag-Erling Smørgrav.Fl S 469d95e11bfSDag-Erling Smørgravoption, which specifies a different start point (in hex). 470d95e11bfSDag-Erling Smørgrav.Pp 471d95e11bfSDag-Erling SmørgravOnce a set of candidates have been generated, they must be tested for 472d95e11bfSDag-Erling Smørgravsuitability. 473d95e11bfSDag-Erling SmørgravThis may be performed using the 474d95e11bfSDag-Erling Smørgrav.Fl T 475d95e11bfSDag-Erling Smørgravoption. 476d95e11bfSDag-Erling SmørgravIn this mode 477d95e11bfSDag-Erling Smørgrav.Nm 478d95e11bfSDag-Erling Smørgravwill read candidates from standard input (or a file specified using the 479d95e11bfSDag-Erling Smørgrav.Fl f 480d95e11bfSDag-Erling Smørgravoption). 481d95e11bfSDag-Erling SmørgravFor example: 482d95e11bfSDag-Erling Smørgrav.Pp 4835e8dbd04SDag-Erling Smørgrav.Dl # ssh-keygen -T moduli-2048 -f moduli-2048.candidates 484d95e11bfSDag-Erling Smørgrav.Pp 485d95e11bfSDag-Erling SmørgravBy default, each candidate will be subjected to 100 primality tests. 486d95e11bfSDag-Erling SmørgravThis may be overridden using the 487d95e11bfSDag-Erling Smørgrav.Fl a 488d95e11bfSDag-Erling Smørgravoption. 489d95e11bfSDag-Erling SmørgravThe DH generator value will be chosen automatically for the 490d95e11bfSDag-Erling Smørgravprime under consideration. 491d95e11bfSDag-Erling SmørgravIf a specific generator is desired, it may be requested using the 492d95e11bfSDag-Erling Smørgrav.Fl W 493d95e11bfSDag-Erling Smørgravoption. 4945e8dbd04SDag-Erling SmørgravValid generator values are 2, 3, and 5. 495d95e11bfSDag-Erling Smørgrav.Pp 496d95e11bfSDag-Erling SmørgravScreened DH groups may be installed in 497d95e11bfSDag-Erling Smørgrav.Pa /etc/moduli . 498d95e11bfSDag-Erling SmørgravIt is important that this file contains moduli of a range of bit lengths and 499d95e11bfSDag-Erling Smørgravthat both ends of a connection share common moduli. 500b15c8340SDag-Erling Smørgrav.Sh CERTIFICATES 501b15c8340SDag-Erling Smørgrav.Nm 502b15c8340SDag-Erling Smørgravsupports signing of keys to produce certificates that may be used for 503b15c8340SDag-Erling Smørgravuser or host authentication. 504b15c8340SDag-Erling SmørgravCertificates consist of a public key, some identity information, zero or 505b15c8340SDag-Erling Smørgravmore principal (user or host) names and an optional set of constraints that 506b15c8340SDag-Erling Smørgravare signed by a Certification Authority (CA) key. 507b15c8340SDag-Erling SmørgravClients or servers may then trust only the CA key and verify its signature 508b15c8340SDag-Erling Smørgravon a certificate rather than trusting many user/host keys. 509b15c8340SDag-Erling SmørgravNote that OpenSSH certificates are a different, and much simpler, format to 510b15c8340SDag-Erling Smørgravthe X.509 certificates used in 511b15c8340SDag-Erling Smørgrav.Xr ssl 8 . 512b15c8340SDag-Erling Smørgrav.Pp 513b15c8340SDag-Erling Smørgrav.Nm 514b15c8340SDag-Erling Smørgravsupports two types of certificates: user and host. 515b15c8340SDag-Erling SmørgravUser certificates authenticate users to servers, whereas host certificates 516b15c8340SDag-Erling Smørgravauthenticate server hosts to users. 517b15c8340SDag-Erling SmørgravTo generate a user certificate: 518b15c8340SDag-Erling Smørgrav.Pp 519b15c8340SDag-Erling Smørgrav.Dl $ ssh-keygen -s /path/to/ca_key -I key_id /path/to/user_key.pub 520b15c8340SDag-Erling Smørgrav.Pp 521b15c8340SDag-Erling SmørgravThe resultant certificate will be placed in 522*8ad9b54aSDag-Erling Smørgrav.Pa /path/to/user_key-cert.pub . 523b15c8340SDag-Erling SmørgravA host certificate requires the 524b15c8340SDag-Erling Smørgrav.Fl h 525b15c8340SDag-Erling Smørgravoption: 526b15c8340SDag-Erling Smørgrav.Pp 527b15c8340SDag-Erling Smørgrav.Dl $ ssh-keygen -s /path/to/ca_key -I key_id -h /path/to/host_key.pub 528b15c8340SDag-Erling Smørgrav.Pp 529b15c8340SDag-Erling SmørgravThe host certificate will be output to 530*8ad9b54aSDag-Erling Smørgrav.Pa /path/to/host_key-cert.pub . 531b15c8340SDag-Erling SmørgravIn both cases, 532b15c8340SDag-Erling Smørgrav.Ar key_id 533b15c8340SDag-Erling Smørgravis a "key identifier" that is logged by the server when the certificate 534b15c8340SDag-Erling Smørgravis used for authentication. 535b15c8340SDag-Erling Smørgrav.Pp 536b15c8340SDag-Erling SmørgravCertificates may be limited to be valid for a set of principal (user/host) 537b15c8340SDag-Erling Smørgravnames. 538b15c8340SDag-Erling SmørgravBy default, generated certificates are valid for all users or hosts. 539b15c8340SDag-Erling SmørgravTo generate a certificate for a specified set of principals: 540b15c8340SDag-Erling Smørgrav.Pp 541b15c8340SDag-Erling Smørgrav.Dl $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub 542*8ad9b54aSDag-Erling Smørgrav.Dl "$ ssh-keygen -s ca_key -I key_id -h -n host.domain user_key.pub" 543b15c8340SDag-Erling Smørgrav.Pp 544b15c8340SDag-Erling SmørgravAdditional limitations on the validity and use of user certificates may 545b15c8340SDag-Erling Smørgravbe specified through certificate constraints. 546b15c8340SDag-Erling SmørgravA constrained certificate may disable features of the SSH session, may be 547b15c8340SDag-Erling Smørgravvalid only when presented from particular source addresses or may 548b15c8340SDag-Erling Smørgravforce the use of a specific command. 549b15c8340SDag-Erling SmørgravFor a list of valid certificate constraints, see the documentation for the 550b15c8340SDag-Erling Smørgrav.Fl O 551b15c8340SDag-Erling Smørgravoption above. 552b15c8340SDag-Erling Smørgrav.Pp 553b15c8340SDag-Erling SmørgravFinally, certificates may be defined with a validity lifetime. 554b15c8340SDag-Erling SmørgravThe 555b15c8340SDag-Erling Smørgrav.Fl V 556b15c8340SDag-Erling Smørgravoption allows specification of certificate start and end times. 557b15c8340SDag-Erling SmørgravA certificate that is presented at a time outside this range will not be 558b15c8340SDag-Erling Smørgravconsidered valid. 559b15c8340SDag-Erling SmørgravBy default, certificates have a maximum validity interval. 560b15c8340SDag-Erling Smørgrav.Pp 561b15c8340SDag-Erling SmørgravFor certificates to be used for user or host authentication, the CA 562b15c8340SDag-Erling Smørgravpublic key must be trusted by 563b15c8340SDag-Erling Smørgrav.Xr sshd 8 564b15c8340SDag-Erling Smørgravor 565b15c8340SDag-Erling Smørgrav.Xr ssh 1 . 566b15c8340SDag-Erling SmørgravPlease refer to those manual pages for details. 567511b41d2SMark Murray.Sh FILES 568511b41d2SMark Murray.Bl -tag -width Ds 569043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/identity 5701e8db6e2SBrian FeldmanContains the protocol version 1 RSA authentication identity of the user. 571a8f6863aSKris KennawayThis file should not be readable by anyone but the user. 572a8f6863aSKris KennawayIt is possible to 573511b41d2SMark Murrayspecify a passphrase when generating the key; that passphrase will be 574b15c8340SDag-Erling Smørgravused to encrypt the private part of this file using 128-bit AES. 575a8f6863aSKris KennawayThis file is not automatically accessed by 576511b41d2SMark Murray.Nm 577511b41d2SMark Murraybut it is offered as the default file for the private key. 578ae1f160dSDag-Erling Smørgrav.Xr ssh 1 579a04a10f8SKris Kennawaywill read this file when a login attempt is made. 580043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/identity.pub 5811e8db6e2SBrian FeldmanContains the protocol version 1 RSA public key for authentication. 582a8f6863aSKris KennawayThe contents of this file should be added to 583043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys 584511b41d2SMark Murrayon all machines 585ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using RSA authentication. 586a8f6863aSKris KennawayThere is no need to keep the contents of this file secret. 587043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa 5881e8db6e2SBrian FeldmanContains the protocol version 2 DSA authentication identity of the user. 589a04a10f8SKris KennawayThis file should not be readable by anyone but the user. 590a04a10f8SKris KennawayIt is possible to 591a04a10f8SKris Kennawayspecify a passphrase when generating the key; that passphrase will be 592b15c8340SDag-Erling Smørgravused to encrypt the private part of this file using 128-bit AES. 593a04a10f8SKris KennawayThis file is not automatically accessed by 594a04a10f8SKris Kennaway.Nm 595a04a10f8SKris Kennawaybut it is offered as the default file for the private key. 596ae1f160dSDag-Erling Smørgrav.Xr ssh 1 597a04a10f8SKris Kennawaywill read this file when a login attempt is made. 598043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_dsa.pub 5991e8db6e2SBrian FeldmanContains the protocol version 2 DSA public key for authentication. 600a04a10f8SKris KennawayThe contents of this file should be added to 601043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys 602a04a10f8SKris Kennawayon all machines 603ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using public key authentication. 6041e8db6e2SBrian FeldmanThere is no need to keep the contents of this file secret. 605043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa 6061e8db6e2SBrian FeldmanContains the protocol version 2 RSA authentication identity of the user. 6071e8db6e2SBrian FeldmanThis file should not be readable by anyone but the user. 6081e8db6e2SBrian FeldmanIt is possible to 6091e8db6e2SBrian Feldmanspecify a passphrase when generating the key; that passphrase will be 610b15c8340SDag-Erling Smørgravused to encrypt the private part of this file using 128-bit AES. 6111e8db6e2SBrian FeldmanThis file is not automatically accessed by 6121e8db6e2SBrian Feldman.Nm 6131e8db6e2SBrian Feldmanbut it is offered as the default file for the private key. 614ae1f160dSDag-Erling Smørgrav.Xr ssh 1 6151e8db6e2SBrian Feldmanwill read this file when a login attempt is made. 616043840dfSDag-Erling Smørgrav.It Pa ~/.ssh/id_rsa.pub 6171e8db6e2SBrian FeldmanContains the protocol version 2 RSA public key for authentication. 6181e8db6e2SBrian FeldmanThe contents of this file should be added to 619043840dfSDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys 6201e8db6e2SBrian Feldmanon all machines 621ae1f160dSDag-Erling Smørgravwhere the user wishes to log in using public key authentication. 622a04a10f8SKris KennawayThere is no need to keep the contents of this file secret. 623d95e11bfSDag-Erling Smørgrav.It Pa /etc/moduli 624d95e11bfSDag-Erling SmørgravContains Diffie-Hellman groups used for DH-GEX. 625d95e11bfSDag-Erling SmørgravThe file format is described in 626d95e11bfSDag-Erling Smørgrav.Xr moduli 5 . 627b66f2d16SKris Kennaway.El 628511b41d2SMark Murray.Sh SEE ALSO 629511b41d2SMark Murray.Xr ssh 1 , 630511b41d2SMark Murray.Xr ssh-add 1 , 631511b41d2SMark Murray.Xr ssh-agent 1 , 632d95e11bfSDag-Erling Smørgrav.Xr moduli 5 , 6331e8db6e2SBrian Feldman.Xr sshd 8 6341e8db6e2SBrian Feldman.Rs 635d4af9e69SDag-Erling Smørgrav.%R RFC 4716 636d4af9e69SDag-Erling Smørgrav.%T "The Secure Shell (SSH) Public Key File Format" 637d4af9e69SDag-Erling Smørgrav.%D 2006 6381e8db6e2SBrian Feldman.Re 639d95e11bfSDag-Erling Smørgrav.Sh AUTHORS 640d95e11bfSDag-Erling SmørgravOpenSSH is a derivative of the original and free 641d95e11bfSDag-Erling Smørgravssh 1.2.12 release by Tatu Ylonen. 642d95e11bfSDag-Erling SmørgravAaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 643d95e11bfSDag-Erling SmørgravTheo de Raadt and Dug Song 644d95e11bfSDag-Erling Smørgravremoved many bugs, re-added newer features and 645d95e11bfSDag-Erling Smørgravcreated OpenSSH. 646d95e11bfSDag-Erling SmørgravMarkus Friedl contributed the support for SSH 647d95e11bfSDag-Erling Smørgravprotocol versions 1.5 and 2.0. 648