ssh on cygwin (win10): read_passphrase: can't open /dev/tty:

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
/cygdrive/c/WINDOWS/System32/OpenSSH/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.)


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