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 life] [command [arg ...]]
ssh-agent [-c | -s] -k
Holds private keys used for public key authentication (RSA, DSA, ECDSA, Ed25519),
started in the beginning of an X-session or a login session, and all other windows or programs are started as
clients to it. Through use of environment variables the agent can be located and automatically used
for authentication when logging in to other machines using ssh(1).
The agent initially does not have any private keys. Keys are added using ssh(1) (see AddKeysToAgent in ssh_config(5) for
details) or ssh-add(1). Multiple identities may be stored in ssh-agent concurrently and ssh(1) will automatically use
them if present. ssh-add(1) is also used to remove keys from ssh-agent and to query the keys that are held in one.
If a command line is given, this is executed as a subprocess of the agent. When the command dies, so does the agent.
| Bind the agent to the UNIX-domain socket bind_address. The default is $TMPDIR/ssh-XXXXXXXXXX/agent.ppid>.
| Don't fork, Foreground mode.
| debug mode.
| default |
|Kill the current agent (given by the |
| Specify a pattern-list of acceptable paths for PKCS#11 shared libraries that may be added using |
ssh-add(1). default allow loading PKCS#11 libraries from ``/usr/lib/*,/usr/local/lib/*''. PKCS#11
libraries that do not match the whitelist will be refused. See PATTERNS in ssh_config(5) for a description of
| 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. The lifetime may be specified in
seconds or in a time format specified in sshd_config(5). A lifetime specified for an identity with ssh-add(1)
overrides this value. default lifetime is forever.
The agent is run in the user's local terminal. Authentication data need not be stored on
any other machine, and authentication passphrases never go over the network. The connection to the agent is
forwarded over SSH remote logins, and the user can thus use the privileges given by the identities anywhere in the netork in a secure way.
agent starts a new subcommand into which some environment variables are exported, eg ssh-agent xterm &.
- agent output 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.
Later ssh(1) looks at these variables and uses them to establish a connection to the agent.
The agent does notsend private key over its request channel. Instead, operations that require a private key will be
performed by the agent, and the result will be returned to the requester. This way, private keys are not exposed to
clients using the agent.
A UNIX-domain socket is created and the name of this socket is stored in
socket is made accessible only to the current user. This method is easily abused by root or another instance of the same
$SSH_AGENT_PID holds the agent's process ID.
The agent exits when the command given on the command line terminates.
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)
The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006.