📄 ssh-keygen.1
字号:
.\" $OpenBSD: ssh-keygen.1,v 1.66 2005/03/01 18:15:56 jmc Exp $.\".\" -*- nroff -*-.\".\" Author: Tatu Ylonen <ylo@cs.hut.fi>.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland.\" All rights reserved.\".\" As far as I am concerned, the code I have written for this software.\" can be used freely for any purpose. Any derived versions of this.\" software must be clearly marked as such, and if the derived work is.\" incompatible with the protocol description in the RFC file, it must be.\" called by a name other than "ssh" or "Secure Shell"..\".\".\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved..\" Copyright (c) 1999 Aaron Campbell. All rights reserved..\" Copyright (c) 1999 Theo de Raadt. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\".\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED..\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..\".Dd September 25, 1999.Dt SSH-KEYGEN 1.Os.Sh NAME.Nm ssh-keygen.Nd authentication key generation, management and conversion.Sh SYNOPSIS.Nm ssh-keygen.Bk -words.Op Fl q.Op Fl b Ar bits.Fl t Ar type.Op Fl N Ar new_passphrase.Op Fl C Ar comment.Op Fl f Ar output_keyfile.Ek.Nm ssh-keygen.Fl p.Op Fl P Ar old_passphrase.Op Fl N Ar new_passphrase.Op Fl f Ar keyfile.Nm ssh-keygen.Fl i.Op Fl f Ar input_keyfile.Nm ssh-keygen.Fl e.Op Fl f Ar input_keyfile.Nm ssh-keygen.Fl y.Op Fl f Ar input_keyfile.Nm ssh-keygen.Fl c.Op Fl P Ar passphrase.Op Fl C Ar comment.Op Fl f Ar keyfile.Nm ssh-keygen.Fl l.Op Fl f Ar input_keyfile.Nm ssh-keygen.Fl B.Op Fl f Ar input_keyfile.Nm ssh-keygen.Fl D Ar reader.Nm ssh-keygen.Fl F Ar hostname.Op Fl f Ar known_hosts_file.Nm ssh-keygen.Fl H.Op Fl f Ar known_hosts_file.Nm ssh-keygen.Fl R Ar hostname.Op Fl f Ar known_hosts_file.Nm ssh-keygen.Fl U Ar reader.Op Fl f Ar input_keyfile.Nm ssh-keygen.Fl r Ar hostname.Op Fl f Ar input_keyfile.Op Fl g.Nm ssh-keygen.Fl G Ar output_file.Op Fl v.Op Fl b Ar bits.Op Fl M Ar memory.Op Fl S Ar start_point.Nm ssh-keygen.Fl T Ar output_file.Fl f Ar input_file.Op Fl v.Op Fl a Ar num_trials.Op Fl W Ar generator.Sh DESCRIPTION.Nmgenerates, manages and converts authentication keys for.Xr ssh 1 ..Nmcan create RSA keys for use by SSH protocol version 1 and RSA or DSAkeys for use by SSH protocol version 2.The type of key to be generated is specified with the.Fl toption..Pp.Nmis also used to generate groups for use in Diffie-Hellman groupexchange (DH-GEX).See the.Sx MODULI GENERATIONsection for details..PpNormally each user wishing to use SSHwith RSA or DSA authentication runs this once to create the authenticationkey in.Pa $HOME/.ssh/identity ,.Pa $HOME/.ssh/id_dsaor.Pa $HOME/.ssh/id_rsa .Additionally, the system administrator may use this to generate host keys,as seen in.Pa /etc/rc ..PpNormally this program generates the key and asks for a file in whichto store the private key.The public key is stored in a file with the same name but.Dq .pubappended.The program also asks for a passphrase.The passphrase may be empty to indicate no passphrase(host keys must have an empty passphrase), or it may be a string ofarbitrary length.A passphrase is similar to a password, except it can be a phrase with aseries of words, punctuation, numbers, whitespace, or any string ofcharacters you want.Good passphrases are 10-30 characters long, arenot simple sentences or otherwise easily guessable (Englishprose has only 1-2 bits of entropy per character, and provides very badpassphrases), and contain a mix of upper and lowercase letters,numbers, and non-alphanumeric characters.The passphrase can be changed later by using the.Fl poption..PpThere is no way to recover a lost passphrase.If the passphrase islost or forgotten, a new key must be generated and copied to thecorresponding public key to other machines..PpFor RSA1 keys,there is also a comment field in the key file that is only forconvenience to the user to help identify the key.The comment can tell what the key is for, or whatever is useful.The comment is initialized to.Dq user@hostwhen the key is created, but can be changed using the.Fl coption..PpAfter a key is generated, instructions below detail where the keysshould be placed to be activated..PpThe options are as follows:.Bl -tag -width Ds.It Fl a Ar trialsSpecifies the number of primality tests to perform when screening DH-GEXcandidates using the.Fl Tcommand..It Fl BShow the bubblebabble digest of specified private or public key file..It Fl b Ar bitsSpecifies the number of bits in the key to create.Minimum is 512 bits.Generally, 1024 bits is considered sufficient.The default is 1024 bits..It Fl C Ar commentProvides a new comment..It Fl cRequests changing the comment in the private and public key files.This operation is only supported for RSA1 keys.The program will prompt for the file containing the private keys, forthe passphrase if the key has one, and for the new comment..It Fl D Ar readerDownload the RSA public key stored in the smartcard in.Ar reader ..It Fl eThis option will read a private or public OpenSSH key file andprint the key in a.Sq SECSH Public Key File Formatto stdout.This option allows exporting keys for use by several commercialSSH implementations..It Fl F Ar hostnameSearch for the specified.Ar hostnamein a.Pa known_hostsfile, listing any occurrences found.This option is useful to find hashed host names or addresses and may also beused in conjunction with the.Fl Hoption to print found keys in a hashed format..It Fl f Ar filenameSpecifies the filename of the key file..It Fl G Ar output_fileGenerate candidate primes for DH-GEX.These primes must be screened forsafety (using the.Fl Toption) before use..It Fl gUse generic DNS format when printing fingerprint resource records using the.Fl rcommand..It Fl HHash a.Pa known_hostsfile, printing the result to standard output.This replaces all hostnames and addresses with hashed representations.These hashes may be used normally by.Nm sshand.Nm sshd ,but they do not reveal identifying information should the file's contentsbe disclosed.This option will not modify existing hashed hostnames and is therefore safeto use on files that mix hashed and non-hashed names..It Fl iThis option will read an unencrypted private (or public) key filein SSH2-compatible format and print an OpenSSH compatible private(or public) key to stdout..Nmalso reads the.Sq SECSH Public Key File Format .This option allows importing keys from several commercialSSH implementations..It Fl lShow fingerprint of specified public key file.Private RSA1 keys are also supported.For RSA and DSA keys.Nmtries to find the matching public key file and prints its fingerprint..It Fl M Ar memorySpecify the amount of memory to use (in megabytes) when generatingcandidate moduli for DH-GEX..It Fl N Ar new_passphraseProvides the new passphrase..It Fl P Ar passphraseProvides the (old) passphrase..It Fl pRequests changing the passphrase of a private key file instead ofcreating a new private key.The program will prompt for the filecontaining the private key, for the old passphrase, and twice for thenew passphrase..It Fl qSilence.Nm ssh-keygen .Used by.Pa /etc/rcwhen creating a new key..It Fl R Ar hostnameRemoves all keys belonging to.Ar hostnamefrom a.Pa known_hostsfile.This option is useful to delete hashed hosts (see the.Fl Hoption above)..It Fl r Ar hostnamePrint the SSHFP fingerprint resource record named.Ar hostnamefor the specified public key file..It Fl S Ar startSpecify start point (in hex) when generating candidate moduli for DH-GEX..It Fl T Ar output_fileTest DH group exchange candidate primes (generated using the.Fl Goption) for safety..It Fl t Ar typeSpecifies the type of key to create.The possible values are.Dq rsa1for protocol version 1 and.Dq rsaor.Dq dsafor protocol version 2..It Fl U Ar readerUpload an existing RSA private key into the smartcard in.Ar reader ..It Fl vVerbose mode.Causes.Nmto print debugging messages about its progress.This is helpful for debugging moduli generation.Multiple.Fl voptions increase the verbosity.The maximum is 3..It Fl W Ar generatorSpecify desired generator when testing candidate moduli for DH-GEX..It Fl yThis option will read a privateOpenSSH format file and print an OpenSSH public key to stdout..El.Sh MODULI GENERATION.Nmmay be used to generate groups for the Diffie-Hellman Group Exchange(DH-GEX) protocol.Generating these groups is a two-step process: first, candidateprimes are generated using a fast, but memory intensive process.These candidate primes are then tested for suitability (a CPU-intensiveprocess)..PpGeneration of primes is performed using the.Fl Goption.The desired length of the primes may be specified by the.Fl boption.For example:.Pp.Dl # ssh-keygen -G moduli-2048.candidates -b 2048.PpBy default, the search for primes begins at a random point in thedesired length range.This may be overridden using the.Fl Soption, which specifies a different start point (in hex)..PpOnce a set of candidates have been generated, they must be tested forsuitability.This may be performed using the.Fl Toption.In this mode.Nmwill read candidates from standard input (or a file specified using the.Fl foption).For example:.Pp.Dl # ssh-keygen -T moduli-2048 -f moduli-2048.candidates.PpBy default, each candidate will be subjected to 100 primality tests.This may be overridden using the.Fl aoption.The DH generator value will be chosen automatically for theprime under consideration.If a specific generator is desired, it may be requested using the.Fl Woption.Valid generator values are 2, 3, and 5..PpScreened DH groups may be installed in.Pa /etc/moduli .It is important that this file contains moduli of a range of bit lengths andthat both ends of a connection share common moduli..Sh FILES.Bl -tag -width Ds.It Pa $HOME/.ssh/identityContains the protocol version 1 RSA authentication identity of the user.This file should not be readable by anyone but the user.It is possible tospecify a passphrase when generating the key; that passphrase will beused to encrypt the private part of this file using 3DES.This file is not automatically accessed by.Nmbut it is offered as the default file for the private key..Xr ssh 1will read this file when a login attempt is made..It Pa $HOME/.ssh/identity.pubContains the protocol version 1 RSA public key for authentication.The contents of this file should be added to.Pa $HOME/.ssh/authorized_keyson all machineswhere the user wishes to log in using RSA authentication.There is no need to keep the contents of this file secret..It Pa $HOME/.ssh/id_dsaContains the protocol version 2 DSA authentication identity of the user.This file should not be readable by anyone but the user.It is possible tospecify a passphrase when generating the key; that passphrase will beused to encrypt the private part of this file using 3DES.This file is not automatically accessed by.Nmbut it is offered as the default file for the private key..Xr ssh 1will read this file when a login attempt is made..It Pa $HOME/.ssh/id_dsa.pubContains the protocol version 2 DSA public key for authentication.The contents of this file should be added to.Pa $HOME/.ssh/authorized_keyson all machineswhere the user wishes to log in using public key authentication.There is no need to keep the contents of this file secret..It Pa $HOME/.ssh/id_rsaContains the protocol version 2 RSA authentication identity of the user.This file should not be readable by anyone but the user.It is possible tospecify a passphrase when generating the key; that passphrase will beused to encrypt the private part of this file using 3DES.This file is not automatically accessed by.Nmbut it is offered as the default file for the private key..Xr ssh 1will read this file when a login attempt is made..It Pa $HOME/.ssh/id_rsa.pubContains the protocol version 2 RSA public key for authentication.The contents of this file should be added to.Pa $HOME/.ssh/authorized_keyson all machineswhere the user wishes to log in using public key authentication.There is no need to keep the contents of this file secret..It Pa /etc/moduliContains Diffie-Hellman groups used for DH-GEX.The file format is described in.Xr moduli 5 ..El.Sh SEE ALSO.Xr ssh 1 ,.Xr ssh-add 1 ,.Xr ssh-agent 1 ,.Xr moduli 5 ,.Xr sshd 8.Rs.%A J. Galbraith.%A R. Thayer.%T "SECSH Public Key File Format".%N draft-ietf-secsh-publickeyfile-01.txt.%D March 2001.%O work in progress material.Re.Sh AUTHORSOpenSSH is a derivative of the original and freessh 1.2.12 release by Tatu Ylonen.Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,Theo de Raadt and Dug Songremoved many bugs, re-added newer features andcreated OpenSSH.Markus Friedl contributed the support for SSHprotocol versions 1.5 and 2.0.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -