LinuxCommandLibrary

ssh-add

Add SSH private keys to authentication agent

TLDR

Add the default SSH keys in ~/.ssh to the ssh-agent

$ ssh-add
copy

Add a specific key to the ssh-agent
$ ssh-add [path/to/private_key]
copy

List fingerprints of currently loaded keys
$ ssh-add -l
copy

Delete a key from the ssh-agent
$ ssh-add -d [path/to/private_key]
copy

Delete all currently loaded keys from the ssh-agent
$ ssh-add -D
copy

Add a key to the ssh-agent and the keychain
$ ssh-add -K [path/to/private_key]
copy

SYNOPSIS

ssh-add [options] [file ...]

PARAMETERS

-l
    List fingerprints of loaded keys

-L
    List public keys of loaded keys

-d
    Remove key from agent

-D
    Remove all keys

-t LIFE
    Set key lifetime

-x
    Lock agent with password

-X
    Unlock agent

-K
    Add keys to macOS keychain

DESCRIPTION

ssh-add adds private key identities to the SSH authentication agent. Once a key is added, it can be used for authentication without entering the passphrase again until the agent is stopped or the key is removed.

CAVEATS

Requires ssh-agent running. Default adds ~/.ssh/id_*. Keys persist until agent stops or explicit removal.

SEE ALSO

ssh-agent(1), ssh(1), ssh-keygen(1)

Copied to clipboard