Where Are SSH Client Private Keys Stored on Ubuntu 14.04?

14.04ssh

On client, after I do ssh-add to add my private key everything works fine, ssh-add -l lists key and I can connect to hosts that have corresponding public key, but nothing changes in .ssh dir as it supposed to.So my question is: How can I locate dir in which are stored private keys added by ssh-add ?

Best Answer

ssh-add doesn't store anything locally or remotely on disk. This command loads your private key, asking once for its password, into the SSH Agent that was previously started.

The SSH Agent holds the private keys in memory only. When you launch the SSH client, it uses the private key from the SSH Agent, without asking for the private key password again, to authenticate against the target server.

The .ssh directory will contains (in the home directory of any user) :

  • authorized_keys : list of public keys allowed to be used to connect to this server
  • config : optional file with configuration parameters for the SSH client
  • the public and private keys you've generated on this host for this user.
  • known_hosts : maintain a list of hosts to which you already connected together with a hash to detect if the host key has changed since the last time.