Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ssh-add - Loading private keys in the authentication agent

&pagelevel(4)&pagelevel

Syntax

ssh-add [-lLdDxXc] [-t <life>] [<file> ...] 
ssh-add -s <reader> 
ssh-add -e <reader> 

A detailed description of the operands is provided in the OpenSSH man pages.

Description

ssh-add provides the authentication agent ssh-agent with private RSA, DSA, ECDSA or Ed25519 keys. If called without arguments, ssh-add adds the files $HOME/.ssh/id_rsa, $HOME/.ssh/id_dsa, $HOME/.ssh/id_ecdsa und $HOME/.ssh/id_ed25519 to the authentication agent. You can specify alternate file names in the command line.

If a file is protected by a passphrase, ssh-add requests the user to enter a passphrase, which ssh-add then reads in from the user’s terminal. If there are multiple secret RSA or DSA keys, ssh-add attempts to reuse the last passphrase read in.

ssh-add -l enables you to have the keys currently administered by ssh-agent to be displayed.

A prerequisite for executing ssh-add is that the authentication agent ssh-agent has been started and that the name of its socket is contained in the environment variable SSH_AUTH_SOCK. The environment variable SSH_AUTH_SOCK is set automatically when ssh-agent is started.

Return value

If successful: 0

If the command specified could not be executed: 1

If ssh-add could not set up a connection to ssh-agent: 2

Environment variable ssh-add

SSH_AUTH_SOCK

Identifies the path name of the socket of a domain in the Unix system which is used for communicating with the authentication agent ssh-agent.

ssh-add files

ssh-add uses the following files:

$HOME/.ssh/id_dsa

Contains the user’s private DSA key for authentication.

$HOME/.ssh/id_rsa

Contains the user’s private RSA key for authentication.

$HOME/.ssh/id_ecdsa

Contains the user’s private ECDSA key for authentication.

$HOME/.ssh/id_ed25519

Contains the user’s private Ed25519 key for authentication.

ssh-add ignores the aforementioned files if they can be accessed by other user IDs. chmod go-rwx ... enables you to block the files against access by other users.