Linux "ssh-add" Command Line Options and Examples
adds private key identities to the authentication agent

ssh-add adds private key identities to the authentication agent, ssh-agent(1). When run without arguments, it adds the files ~/.ssh/id_rsa, ~/.


Usage:

ssh-add [-cDdkLlqXx] [-E fingerprint_hash] [-t life] [file ...]
   ssh-add -s pkcs11
   ssh-add -e pkcs11






Command Line Options:

-D
Deletes all identities from the agent.
ssh-add -D ...
-E
Specifies the hash algorithm used when displaying key fingerprints. Valid options are: “md5” and“sha256”. The default is “sha256”.
ssh-add -E ...
-e
Remove keys provided by the PKCS#11 shared library pkcs11.
ssh-add -e ...
-L
Lists public key parameters of all identities currently represented by the agent.
ssh-add -L ...
-l
Lists fingerprints of all identities currently represented by the agent.
ssh-add -l ...
-q
Be quiet after a successful operation.
ssh-add -q ...
-s
Add keys provided by the PKCS#11 shared library pkcs11.
ssh-add -s ...
-t
Set a maximum lifetime when adding identities to an agent. The lifetime may be specified in seconds orin a time format specified in sshd_config(5).
ssh-add -t ...
-X
Unlock the agent.
ssh-add -X ...
-x
ENVIRONMENTDISPLAY and SSH_ASKPASSIf ssh-add needs a passphrase, it will read the passphrase from the current terminal if it was run froma terminal. If ssh-add does not have a terminal associated with it but DISPLAY and SSH_ASKPASS are set,it will execute the program specified by SSH_ASKPASS (by default “ssh-askpass”) and open an X11 windowto read the passphrase. This is particularly useful when calling ssh-add from a .xsession or relatedscript. (Note that on some machines it may be necessary to redirect the input from /dev/null to makethis work.)SSH_AUTH_SOCKIdentifies the path of a UNIX-domain socket used to communicate with the agent.FILES~/.ssh/id_dsaContains the DSA authentication identity of the user.~/.ssh/id_ecdsaContains the ECDSA authentication identity of the user.~/.ssh/id_ed25519Contains the Ed25519 authentication identity of the user.~/.ssh/id_rsaContains the RSA authentication identity of the user.Identity files should not be readable by anyone but the user. Note that ssh-add ignores identity files if theyare accessible by others.EXIT STATUSExit status is 0 on success, 1 if the specified command fails, and 2 if ssh-add is unable to contact the authen‐tication agent.
ssh-add -x ...