authentication key generation, management and conversion
ssh-keygen [-q] [-b bits] -t type [-N new_passphrase] [-C comment] [-f output_keyfile](import|export)
ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
ssh-keygen -i|e [-f keyfile]
(yank private OpenSSH, output public key)
ssh-keygen -y [-f keyfile]
ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
ssh-keygen -l [-f keyfile]
ssh-keygen -B [-f keyfile]
ssh-keygen -F hostname [-f known_hosts_file] [-l]
ssh-keygen -H [-f known_hosts_file]
ssh-keygen -R hostname [-f known_hosts_file]
download|Upload to reader
ssh-keygen -D|U reader
ssh-keygen -r hostname [-f input_keyfile] [-g]
Generates, manages and converts authentication keys for ssh.
Creates RSA keys protocol version 1 and RSA or DSA keys for version 2 as specified with
Generates groups for use in Diffie-Hellman group exchange (DH-GEX).
Generates host keys for
Users runs this to create their authentication key .
With SSH keys, if someone gains access to your computer, they also gain access to every system that uses that key.
To add an extra layer of security, you can add a passphrase to your SSH key.
You can use ssh-agent to securely save your passphrase so you don't have to reenter it.
Passphrase may be a string of arbitrary length, changed using
Similar to a password can be a phrase of words, punctuation, numbers, whitespace, or any string.
For RSA1 keys a comment field to the user to help identify the key, changed using
| RSA vs DSA (when in doubt pick DSA IMHO ) Digital Signature Algorithm vs Ron Rivest, Adi Shamir, and Leonard Adleman.
|number of bits in the key For RSA minimum 768 and default: 2048 bits. DSA 1024
|Download the RSA public key to a smartcard in reader. |
Upload an existing RSA private key into the smartcard in reader.
|export key in RFC 4716 SSH Public Key File Format to stdout
Useful to find hashed host names or addresses and may also be used with
known_hosts the original is moved to
|Removes keys from |
known_hosts file useful to delete hashed hosts
| Reads an unencrypted private key file or RFC4716 Public Key and outputs an OpenSSH to stdout.
| key file.
| list fingerprint of specified public key file. |
-v, an ASCII art representation of the key output:
|Show the bubblebabble digest
|Requests changing the passphrase of a private key file instead of creating a new private key.
Prompts for the file containing the private key, for the old passphrase, and twice for the new passphrase.
-P current passphrase
| quite (Used by |
/etc/rc when creating a new key.)
|reveal the |
SSHFP fingerprint resource record named hostname for the specified public key file. Default
|Use generic DNS format when outputing fingerprint resource records using |
|read a private file and output public key to stdout.
Generating public/private rsa key pair.
Enter file in which to save the key (/Volumes/DATA/dgerman/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Volumes/DATA/dgerman/.ssh/id_rsa.
Your public key has been saved in /Volumes/DATA/dgerman/.ssh/id_rsa.pub.
The key fingerprint is:
The key's randomart image is:
| ..o |
| o o + |
| . = * o . |
| o % + + o |
| . & S = E |
|. . = X . . |
| . o..= o |
| +.==o+ . |
> ssh-keygen -B
Enter file in which the key is (/Volumes/DATA/dgerman/.ssh/id_rsa):
2048 xugel-tymes-mopal-vyzoz-xxxxx-yyyyy-zzzzz-fucyc-kehip-nelef-vuxyx username@clienthost (RSA)
> sh-keygen -l
Enter file in which the key is (/Volumes/DATA/dgerman/.ssh/id_rsa):
2048 SHA256:oTvL+xxxxxxxxxx62yyyyyyyyyyEZtMaUymJVX/OLdY username@clienthost (RSA)/pre>
| version 1 RSA authentication identity of the user. Must be not be readable by
by group or others. It is possible to specify a passphrase when generating the key which is
used to encrypt the private part using 3DES. Not automatically accessed by ssh-keygen
but is the default file for the private key. Read by ssh at login
| version 1 RSA public key|
. Add to
| version 2 DSA authentication identity of the user. Must be not be readable by
by group or others. It is possible to specify a passphrase when generating the key is
used to encrypt the private part of this file using 3DES. Not automatically accessed by ssh-keygen
but default is the file for the private key. Read by ssh at login
| version 2 DSA public key.|
| version 2 RSA authentication identity of the user. Must be not be readable by
by group or others. A passphrase when generating the key used to encrypt the private part of this file using 3DES. Not automatically accessed by ssh-keygen
default file for the private key. Read by ssh at login
| version 2 RSA public key . Added to |
| for DH-GEX. See moduli
ssh-agent [-c | -s ] [-Dd] [-a bind_address] [-E fingerprint_hash ] [-P pkcs11_whitelist ] [-t lifetime]
[command [arg …]]
ssh-agent [-c | -s] -k
Outputs private keys used for public key authentication used when logging in to other machines using ssh.
Started in the beginning of a login session or an X-session .
Keys are added or removed using ssh-add (see AddKeysToAgent in ssh_config(5) for details) ssh-add(1).
|Bind to socket. Default |
| Don't fork, Foreground .
| default |
|Kill the current agent from |
| a pattern-list of acceptable paths for PKCS#11 shared libraries that may be added using |
Default allow loading PKCS#11 libraries from
PKCS#11 libraries that do not match the whitelist will be refused. See PATTERNS in ssh_config(5) for pattern-list syntax.
| Generate C-shell commands on stdout. default if SHELL looks like it's a csh style of shell.
| Generate Bourne shell commands on stdout. default if SHELL does not look like it's a csh style of shell.
| maximum lifetime of identities added to the agent in
seconds or in a time format specified in sshd_config(5). |
A lifetime specified for an identity with ssh-add overrides this value.
command executed as a subprocess of the agent. When the command dies, so does the agent.
agent starts a new subcommand into which some environment variables are exported, eg ssh-agent xterm &.
- agent outputs the needed shell commands
(either sh(1) or csh(1) syntax can be generated) which can be evaluated in the calling shell, eg eval `ssh-agent -s` for
Bourne-type shells such as sh(1) or ksh(1) and eval `ssh-agent -c` for csh(1) and derivatives.
$SSH_AGENT_PID holds the agent's process ID.
The agent exits when the command given on the command line terminates.
SSH_AUTH_SOCK=/var/folders/rr/jvwb6c9j2h18lzc28kzws_940000gn/T//ssh-oZQicexUeNIT/agent.91702; export SSH_AUTH_SOCK;
SSH_AGENT_PID=91703; export SSH_AGENT_PID;
echo Agent pid 91703
UNIX-domain sockets used to contain the connection to the authentication agent. These sockets should only be
readable by the owner. The sockets should get automatically removed when the agent exits.
ssh(1), ssh-add(1), ssh-agent(1), moduli(5), sshd(8)