Command Line Examples: ssh-add ~/.ssh/id_rsa.pub ?

All,

http://ansible.cc/docs/examples.html, says “$ ssh-add ~/.ssh/id_rsa.pub”

Is that typo or am I missing something?

===man ssh-add===
ssh-add — adds private key identities to the authentication agent

Thanks,
Rhea

generally, for id_<crypto>.pub it's
ssh-add

Sorry, I did not understand what you meant but I’m assuming that it’s correct and not a typo. But the command does not work for me with the .pub file but works well with the private key. Why do I need to add public key also, my public key will be with other nodes and I need the private key to authenticate right?

[root@controller .ssh]# ssh-add id_rsa.pub
Enter passphrase for id_rsa.pub:
Bad passphrase, try again for id_rsa.pub:
Bad passphrase, try again for id_rsa.pub:

[root@controller .ssh]# ssh-add id_rsa
Enter passphrase for id_rsa:
Identity added: id_rsa (id_rsa)
[root@controller .ssh]#

-Rhea

Why do I need to add public key
also, my public key will be with other nodes and I need the private key to
authenticate right?

You don't add the public key, which is on the nodes, just the private
key which is used for authenticating against the public key on the
nodes. You are correct. :slight_smile:

        -JP

Thank you. Is the instruction on http://ansible.cc/docs/examples.html incorrect? I can safely replace the step $ ssh-add ~/.ssh/id_rsa.pub with $ ssh-add ~/.ssh/id_rsa ?

-Rhea

Yes, it's a definite typo.

Patches to the documentation can be made by editing the
docsite/rst/*.rst files in the checkout, and then submitting a github
pull request.

Is the instruction on http://ansible.cc/docs/examples.html incorrect?
I can safely replace the step *$ ssh-add ~/.ssh/id_rsa.pub with $ ssh-add
~/.ssh/id_rsa ?*

You add your private keys, irrespective of what their filenames are. In
other words, if you created your key in a file called
"id_rhea_ansible.gizmo", you would then `ssh-add ~/.ssh/id_rhea*.gizmo'. :slight_smile:

And yes, the example is basically incorrect. I'll submit a doc patch in
a moment (but it will be some time before that shows up on the Web site).

        -JP

Cool :slight_smile: Thank you very much.

Since I’m still beginning with all of this, the example confused me :slight_smile:

Thanks again!