I have a box I'm trying to create an SSH tunnel to using a keypair without a password. If I run cygwin.exe and generate a keypair without a password using ssh-keygen and put the public key on the server I can use ssh to create a tunnel between the 2 boxes no problem.

My question though is this. Can I do this without having to run cygwin.bat and use ssh.exe directly from a command prompt.

When I try this I am prompted for the user's password and it is not using the keypair. I'm assuming that when I run cygwin.exe it is loading up my usr directory and using the keypair from the .ssh directory and when I run ssh.exe directly it is not loading my usr directory and therefore it is not trying to use the keypair and is prompting me for my password.

How do I solve this problem?

  • I've been using cygwin based tools (more basic than ssh though) directly for years and didn't event know that there was a "cygwin.exe". – LatinSuD Jun 3 '11 at 13:32
  • @LatinSuD - Sorry, it may not be Cygwin.exe, but the Cygwin console is what I mean. (When you double click the Cygwin shortcut after installation) – J.r. Hounddog Jun 3 '11 at 13:50
  • @LatinSUD - Looks like it is Cygwin.bat – J.r. Hounddog Jun 3 '11 at 13:56

In my case it works both ways: through cygwin.bat and directly invoking ssh.exe from cmd.

I suggest this workaround:

cd \cygwin\bin
ssh.exe -i ..\home\Adminstrator\id_rsa user@host

If paths and stuff are correct it must work too.

  • Thank you. This is exactly what I wanted. I'd +1 but not enough rep yet on this site. :) – J.r. Hounddog Jun 3 '11 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.