PowerShell / Win32-OpenSSH

Win32 port of OpenSSH
7.2k stars 739 forks source link

SSH 9.5 communiction error with SSH agent, but works with SSH 8.6 #2235

Closed trallnag closed 1 month ago

trallnag commented 1 month ago

Steps to reproduce

Make sure OpenSSH_for_Windows_9.5p1 is installed.

Create key pair.

Add public key to GitHub.

Add private key to SSH agent.

Execute ssh -T git@github.com

Expected behavior

> C:/Windows/System32/OpenSSH/ssh.exe -T git@github.com
Hi trallnag! You've successfully authenticated, but GitHub does not provide shell access.

Actual behavior

> & "C:\Program Files\OpenSSH\ssh.exe" -T git@github.com
git@github.com: Permission denied (publickey).

> & "C:\Program Files\OpenSSH\ssh.exe" -vvvvvvvvvvv -T git@github.com
...
debug3: ssh_get_authentication_socket_path: path '\\\\.\\pipe\\openssh-ssh-agent'
debug2: get_agent_identities: ssh_agent_bind_hostkey: communication with agent failed
debug3: write ERROR from cb(2):232, io:000001757256D690
debug1: get_agent_identities: ssh_fetch_identitylist: communication with agent failed
...
git@github.com: Permission denied (publickey).

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Misc

I can only reproduce the bug on my work computer. On my personal computers it is all working fine. There I am running Windows 10.0.22631.

Maybe related:

trallnag commented 1 month ago

...I think I found the problem, it is a version mismatch. For whatever reason ssh-agent is using older version.

image

Solution:

Uninstall OpenSSH beta:

winget uninstall Microsoft.OpenSSH.Beta

Uninstall "old" ssh:

Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

Restart. Install again:

winget install Microsoft.OpenSSH.Beta --override ADDLOCAL=Client