SolvedWin32 OpenSSH Can't add keys to ssh-agent, communication with agent failed

"OpenSSH for Windows" version

(Get-Item (Get-Command ssh).Source).VersionInfo.FileVersion
7.6.0.0

Installed in c:\Windows\System32\OpenSSH in the 1803 Windows update.

Client OperatingSystem
Windows 10 Pro 1803

What is failing
ssh-add can't add keys to the ssh-agent.

Expected output
The keys are accepted and listed when ssh-add -l is run.

Actual output

ssh-add ..ssh\secret.pem
Could not add identity "..ssh\secret.pem": communication with agent failed

ssh-add -l
error fetching identities: communication with agent failed

output from ssh-agent.log:
4688 2018-08-16 15:19:37.613 error: LookupAccountNameW on SSHD account failed with 1789
4688 2018-08-16 15:19:37.615 fatal: failed to retrieve client details
13372 2018-08-16 15:32:40.157 error: LookupAccountNameW on SSHD account failed with 1789
13372 2018-08-16 15:32:40.157 fatal: failed to retrieve client details
972 2018-08-16 15:42:25.752 error: LookupAccountNameW on SSHD account failed with 1789
972 2018-08-16 15:42:25.752 fatal: failed to retrieve client details
9088 2018-08-16 15:47:46.669 error: LookupAccountNameW on SSHD account failed with 1789
9088 2018-08-16 15:47:46.672 fatal: failed to retrieve client details

There doesn't seem to be an sshd.exe in C:\Windows\System32\OpenSSH. I think I'm just missing a setting somewhere because I've gotten this working on other Windows machines of the same version with no issue.

26 Answers

✔️Accepted Answer

That check in ssh-agent can be removed as sshd now runs as SYSTEM. We'll fix it.

As a workaround to unblock you, could you create/install a dummy sshd service like this:
sc.exe create sshd binPath=C:\Windows\System32\OpenSSH\ssh.exe

Other Answers:

That check in ssh-agent can be removed as sshd now runs as SYSTEM. We'll fix it.

As a workaround to unblock you, could you create/install a dummy sshd service like this:
sc.exe create sshd binPath=C:\Windows\System32\OpenSSH\ssh.exe

Sorry to reanimate a dead thread, but just wanted to chime in that this solution works even for this failure in Oct 2019, thank you very much!

@manojampalam are you able to give an indication as to when this might ship? This ticket is closed but the need to create a dummy sshd service is still present even in Insiders builds.

ssh-agent was disabled, and even after enabling refused to work until I created the dummy sshd service, on upgrade to 19569.1000.

The workaround is still relevant in July 2020!

I created the dummy sshd service as described.

ssh-add now works as expected. Thank you @manojampalam! This was driving me crazy.

More Issues: