12

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 ?

18

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.
2

ssh-add is not supposed to change anything in ~/.ssh. It tells the ssh-agent program which identities to add, and the ssh-agent program stores them in memory after asking for passphrases. So there is no such directory.

0
~/.ssh/id_rsa

This article shows you how to generate the key to the above path. It's not my article :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.