Forrest logo
back to the ssh-add tool

ssh:tldr:3f7bb

ssh: Add the default ssh keys in `~/.ssh` to the ssh-agent.
$ ssh-add
try on your machine

The ssh-add command is used to add private key identities to the OpenSSH authentication agent. When you connect to a remote server using the Secure Shell (SSH) protocol, you typically authenticate yourself by providing a private key that corresponds to the public key stored on the server.

The ssh-add command helps you manage and add these private keys to your SSH agent, which is a program that runs in the background and holds your decrypted private keys for authentication purposes. This eliminates the need to repeatedly enter your passphrase each time you make an SSH connection.

Running ssh-add without any arguments will display the currently loaded identities in the SSH agent. It will list the private keys that are currently associated with your agent.

To add a private key to the agent, you can run ssh-add followed by the path to the private key file. For example, ssh-add ~/.ssh/id_rsa adds the private key file located at ~/.ssh/id_rsa to the agent.

The ssh-add command also supports other options to manage and manipulate the identities in the agent, such as specifying a specific lifetime for the added key or removing a specific key from the agent.

By using the ssh-add command, you can conveniently manage your private keys and make SSH connections without having to repeatedly enter your passphrase for each connection.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ssh-add tool