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, ~/.
ssh-add [-cDdkLlqXx] [-E fingerprint_hash] [-t life] [file ...]
ssh-add -s pkcs11
ssh-add -e pkcs11
Command Line Options:
Deletes all identities from the agent.
ssh-add -D ...
Specifies the hash algorithm used when displaying key fingerprints. Valid options are: “md5” and“sha256”. The default is “sha256”.
ssh-add -E ...
Remove keys provided by the PKCS#11 shared library pkcs11.
ssh-add -e ...
Lists public key parameters of all identities currently represented by the agent.
ssh-add -L ...
Lists fingerprints of all identities currently represented by the agent.
ssh-add -l ...
Be quiet after a successful operation.
ssh-add -q ...
Add keys provided by the PKCS#11 shared library pkcs11.
ssh-add -s ...
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 ...
Unlock the agent.
ssh-add -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 ...