5

I'm having trouble with ssh-agent under cygwin. The crazy part is that it was working, but stopped after a reboot one day. Here is an example:

sthomas@sthomas-tcg ~ $ keychain ~/.ssh/id_rsa KeyChain 2.6.8; http://www.gentoo.org/proj/en/keychain/ Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL * Initializing /home/sthomas/.keychain/sthomas-tcg-sh file... * Initializing /home/sthomas/.keychain/sthomas-tcg-csh file... * Initializing /home/sthomas/.keychain/sthomas-tcg-fish file... * Starting ssh-agent * Adding 1 ssh key(s)... Enter passphrase for /home/sthomas/.ssh/id_rsa: Identity added: /home/sthomas/.ssh/id_rsa (/home/sthomas/.ssh/id_rsa) sthomas@sthomas-tcg ~ $ ssh-add Could not open a connection to your authentication agent. sthomas@sthomas-tcg ~ $ ssh stage Enter passphrase for key '/home/sthomas/.ssh/id_rsa': 

I found this user who is having the exact same problem as me

Issues with ssh-add

Unfortunately I don't have enough rep to comment there. I tried following his instructions but the first step is not working for me:

sthomas@sthomas-tcg ~ $ `eval ssh-agent` -bash: SSH_AUTH_SOCK=/tmp/ssh-ejseksys5348/agent.5348;: No such file or directory 

Anyone know what is going wrong here? The file does exist but the missing filename changes on each execution.

sthomas@sthomas-tcg ~ $ ls /tmp/ssh-ejseksys5348/agent.5348 /tmp/ssh-ejseksys5348/agent.5348 
5
  • Hmm. Can you do export SSH_AUTH_SOCK=/tmp/ssh-ejseksys5348/agent.5348 and then do the ssh-add? Commented Apr 25, 2012 at 16:24
  • @cjc wouldn't that only be a temporary fix? Commented Apr 25, 2012 at 16:29
  • Simple question, but is the ssh-agent process running? Commented Apr 25, 2012 at 17:01
  • @mgorven The OP's post suggests it's running, since he ran the command and there's a resulting socket file. The problem is to get ssh-agent's environmental variables exported so that ssh can see them. Commented Apr 25, 2012 at 17:11
  • @cjc Based on "the missing filename changes on each execution" I suspected that the process wasn't hanging around, but now I see that ssh-agent doesn't handle an existing running agent nicely and so this is expected. Commented Apr 25, 2012 at 17:17

2 Answers 2

8

OK, that other Serverfault.com answer has a typo.

The right thing you want to run is:

eval `ssh-agent` 

ssh-agent spits out a bunch of shell statements to set environmental variables. The eval runs them in the current shell. You can invoke ssh-agent that way, or run ssh-agent and then copy-paste its output into your current shell for the same effect.

0
1

fixed another aspect of this message : I imported a key from a mint VM to cygwin. I used nano without nowrap and copied my public key over 3 lines instead of 1. I had to put in on an unique line and it finaly worked with eval.

1
  • I'm confused. Are you commenting on an answer on a completely different question? Commented May 2, 2016 at 17:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.