ssh-add / ssh-agent issue

Problem with ssh-add / ssh-agent under cygwin

So, when I tried to ssh-add, I got the infamous "Could not open a connection to your authentication agent" message. Searching for this problem, I found this promising article suggesting the following:

  • start the ssh-agent by doing: exec ssh-agent /usr/bin/bash
  • a new shell is created
  • from there, do: ssh-add ~/.ssh/id_dsa

OK, great but this DID NOT work under cygwin ssh (broken for the past year or so after some update). This solution may work under other flavor of Linux / Unix.

Solution

The only way I found to get it to work is to:

  • In one cygwin windows, use: ssh-agent -d
  • This will start the agent in debug mode. Note the information on SSH_AUTH_SOCK.
  • Open a second cygwin terminal and, and define SSH_AUTH_SOCK in that second window (setenv or export depending on csh or bash)
  • Now start ssh-add
  • Works fine now ... don't ask me why it needs -d to work.

I will update this blog if I learn more.