Executing ssh on cygwin under windows 10 recently started failing, after many years of stable logins. The relevant output from ssh under a mintty from Xwindows:

%  ssh -tt -vvv <user@host>
debug3: Failed to open file:C:\\ProgramData\\ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:\\ProgramData\\ssh/ssh_known_hosts2 error:2
debug3: failed to open file:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
debug3: spawning /usr/X11R6/bin/ssh-askpass
CreateProcessW failed error:2
ssh_askpass: posix_spawn: No such file or directory
Host key verification failed.

The special file /dev/tty is there:

% ls -la /dev/tty
crw-rw-rw- 1 jpmattia None 5, 0 May 22 15:04 /dev/tty

I updated Cygwin to make sure all the binaries were the latest. Also windows updated itself earlier this week.

I'm a little baffled as to what might be going on. Clues gratefully accepted.


Documenting my solution in case anyone else has the problem: It appears that a Windows version of OpenSSH was introduced in the 2018 spring update, and it is being called instead of Cygwin's ssh. (See e.g. https://www.zdnet.com/article/openssh-arrives-in-windows-10-spring-update/)

% which ssh

The reason for the sudden problem with ssh is that the cygwin PATH has /cygdrive/c/WINDOWS/System32 ahead of /usr/bin/. Or at least, mine did.

So the issue is solved by calling /usr/bin/ssh explicitly. (Reordering the PATH is also a possible solution, but not for my environment.)

  • 1
    /usr/bin does not include ssh on my fresh installation of Cygwin :( – Christoph Geschwind Jul 8 '18 at 16:13
  • 2
    Cygwin has an openssh package that must be installed to get the ssh client and ssh client tools. – Jason Slobotski Aug 4 '18 at 2:20
  • 2
    As other comments have hinted at, you must also install openssh, as it is not installed by default. – timelmer Dec 5 '18 at 4:27
  • 1
    if you install openssh (by re-running cygwin installer and selecting the openssh package), "which ssh" command should switch to show "usr/bin/ssh" instead of "cygdrive/c/WINDOWS/..." (without any additional manual path reordering) – VeraKozya Feb 4 '19 at 19:30
  • 1
    I had the same problem when /usr/bin/ssh was not executable after a move from C to D. Worth mentioning since the error message is so obscure. – rickfoosusa Jan 22 at 0:36

If A fresh install of cygwin and having the sames issues, make sure to select openssh packages as part of the installation

The ssh client come with windows 10 only can be used via cmd.exe not cygwin terminal

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.