ssh-keygen Command Line Options
The ssh-keygen syntax is:
ssh-keygen [-b bits] [-c comment] [-D private_key] [-e private_key] [-F key]
Use ssh-keygen to create RSA and DSA keys for public key authentication, to edit the properties of existing keys, and to convert key file formats for compatibility with other Secure Shell implementations.
When no options are specified, ssh-keygen generates a 2048-bit RSA key pair and queries you for a passphrase to protect the private key. If you don't specify a file name on the command line, keys are created in $HOME/.ssh2/ and given a default name that identifies the key type, size, and host name (for example /home/joe/.ssh2/id_rsa_2048_myhost_a). If you specify a file name, keys are saved to the current working directory unless you include a fully qualified path name. For each private key you create, ssh-keygen also generates a public key. Public keys are given the same base name as the private key, with an added .pub extension (for example id_rsa_2048_myhost_a.pub).
Command Line Options
Options are available in both a single-character form (such as -b) and a descriptive equivalent (--bits). Single characters are shown here. To view the descriptive equivalents, use the -h command line option.
Specifies the key size. Up to a point, a larger key size improves security. Increasing key size slows down the initial connection, but has no effect on the speed of encryption or decryption of the data stream after a successful connection has been made. The length of key you should use depends on many factors, including: the key type, the lifetime of the key, the value of the data being protected, the resources available to a potential attacker, and the size of the symmetric key you use in conjunction with this asymmetric key. To ensure the best choice for your needs, we recommend that you contact your security officer. The default for DSA keys is 1024 bits and for RSA keys is 2048 bits. The minimum allowed value is 512. The maximum allowed value is 32768.
Specifies information for the comment field within the key file. Use quotation marks if the string includes spaces. If you do not specify a comment, a default comment is created that includes the key type, creator, date, and time. Note: The comment is displayed when a passphrase-protected key is used for client authentication. Don't store passphrases or other sensitive information in the comment.
Uses the specified private key to derive a new copy of the public key.
Changes the passphrase of the specified private key. When you use this option alone you will be queried for the old and new passphrase for the specified private key. To edit the passphrase without opening an interactive session, you can use this option in combination with -p and-N. To change to a null passphrase, you can use this option in combination with -P.
Displays the fingerprint of the specified key in Bubble Babble format.
Displays a brief summary of command options.
Uses the specified Reflection public key to generate a public key in OpenSSH format. The converted key is created using the same base file name with an added .ssh extension. You can use the key that is created to configure public key client authentication on an OpenSSH server.
Displays information about the specified key.
Changes the passphrase to the specified new passphrase. Use this option is combination with -e.
Specifies the file name to be used for the generated private key. (A public key is also created and is always given the same name as the private key, with an added .pub file extension.) Note: An alternate way of naming key files is to specify one or more key file names at the end of the ssh-keygen command.
Uses the specified OpenSSH public or private key to create a public or private key in Reflection format. The converted key is created using the same base file name with an added .ssh2 extension.
Specifies a passphrase. Use quotation marks if the phrase includes spaces. This option creates the initial passphrase when you generate a new key. If you are managing an existing key, use this option to specify the passphrase that protects that key. If a passphrase is required and you don't use -p, you'll be prompted for the passphrase.
Creates a key with no passphrase. You can use this option to create keys for server authentication. Passphrases are recommended for client keys.
Hides the key generation progress indicator.
Specifies the algorithm used for key generation. Possible values are "rsa" and "dsa".
Displays ssh-keygen version information.
Specifies the file name (or names) to be used for the generated private key (or keys). The public key is created using the same name with a ".pub" file extension.