Re: cygwin ssh-add problem

From: Alan Hadsell (ahadsell@MtDiablo.com)
Date: 04/16/02


From: Alan Hadsell <ahadsell@MtDiablo.com>
Date: Tue, 16 Apr 2002 03:36:02 GMT

eho <ericmho@shaw.ca> writes:

> I'm running the latest cygwin and openssh (1.3) and I have problem to
> get the ssh-add going. It always gives me:
>
> Could not open a connection to your authentication agent.
>
> I'm wondering anyone has successfully implemented ssh-agent and ssh-add
> under cygwin? Thanks

Sure, it works fine here.

The problem is probably that you haven't arranged for the proper
environment variables to be available for ssh-add, so that it can
locate the agent.

If you just start ssh-agent from bash, you'll see something like this:

,----
| $ ssh-agent
| SSH_AUTH_SOCK=/tmp/ssh-eGmI1492/agent.1492; export SSH_AUTH_SOCK;
| SSH_AGENT_PID=1456; export SSH_AGENT_PID;
| echo Agent pid 1456;
`----

This is meant to be information that goes into your environment, where
it will be available to ssh-add (and to the ssh client). The simple
way to arrange this is to say instead:

,----
| $ eval `ssh-agent`
| Agent pid 1784
`----

What this does is cause the environment settings to be passed back to
bash, where they are stored in environment variables:

,----
| $ env | grep SSH
| SSH_AGENT_PID=1784
| SSH_AUTH_SOCK=/tmp/ssh-vcRr1820/agent.1820
`----

This will allow ssh-add (and the ssh client) to work correctly, as
long as it is invoked from the same bash shell that started
ssh-agent.

This doesn't work if you want to use ssh from applications started
from the desktop. I have an insecure hack that I use in those cases,
which I can post if you're interested.

-- 
Alan Hadsell
If brute force doesn't work, you aren't using enough.



Relevant Pages

  • Re: sshd read environment variable?
    ... > can sshd 2.9 read environment variables for the password? ... > if i automate the distribution of files across servers (yes, ... Have you read about ssh-agent and ssh-add to keep your password's cached? ... Of course then you'll also need ssh-askpass (a X frontend for ssh-add). ...
    (comp.security.ssh)
  • Need help with SSH set-up
    ... I'm setting up SSH to replace telnet for use on my LAN. ... basic functionality working but I'm struggling with ssh-agent and ... ssh-add, but I can't figure out how. ...
    (Debian-User)
  • Re: Need help with SSH set-up
    ... ssh-agent should already be started for you if you simply use the ... Simply run ssh-add from a gnome-terminal. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • Re: ssh-keygen between SuSE and FreeBSD
    ... You need to start an ssh-agent on the machine you're connecting from and ... see if it has ssh session support. ... If the ssh-agent and ssh-add utilities load the keys into memory, ... rebooting will take the keys out of memory and you would need to ...
    (freebsd-stable)
  • Re: cygwin ssh-add problem
    ... Hi Alan, ... But I did use eval `ssh-agent`, ... ssh-add command as attached below: ... > | echo Agent pid 1456; ...
    (comp.security.ssh)