beautifulcode / ssh-copy-id-for-OSX

Quick Mac OSX port of the useful unix utility ssh-copy-id
887 stars 108 forks source link

The agent has no identities. #5

Closed tremby closed 11 years ago

tremby commented 11 years ago

Similar to #3, I believe.

I had a similar issue -- the script exited with code 1 with no error, and on inspecting authorized_keys on the remote the string The agent has no identities. had been added. This was the output of ssh-add -L, even though I did have an id_rsa file. The solution for me was to run ssh-add alone, which gave some encouraging output, and after that ssh-add -L gives the expected output and so running ssh-copy-id again worked.

I'm surprised by that because I've never had to run that before.

Perhaps ssh-add could be run automatically if ssh-add -L returns an error code (I didn't check if it did, but presumably it does in this case), or at least notify the user that they may want to run it. And obviously don't add something to the remote's authorized_keys if it's not actually a key!

beautifulcode commented 11 years ago

Hi there. I merged #3's pull-request in. Can you see if this fixes things for you?

tremby commented 11 years ago

I had a new server to log in to today. I tried ssh-add -L before doing anything else and got The agent has no identities..

I ran ssh-copyid with the hostname, accepted the host's key and got exit code 1. I then tried to log in and it asked for my password. I entered it and logged in. Printing out authorized_keys shows a garbled line like in #6.

Given that the line The agent has no identities is not in the authorized_keys file, this issue is fixed but obviously the other still exists.