Skip to content

Can't add keys to ssh-agent, communication with agent failed #1234

Closed

Description

@draftsteve

"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.

Activity

  1. manojampalam commented on Aug 17, 2018

    @manojampalam
    Contributor

    see if this helps: #1133

  2. draftsteve commented on Aug 17, 2018

    @draftsteve
    Author

    I read through this issue.

    I am using posh-git so I tried deleting the environment variables SSH_AGENT_PID and SSH_AUTH_SOCK but they don't exist. I'm guessing I'm using a newer version of posh-git?

    Not loading posh-git doesn't seem to help either and the ssh-agent service starts fine.

  3. manojampalam commented on Aug 17, 2018

    @manojampalam
    Contributor

    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

  4. draftsteve commented on Aug 20, 2018

    @draftsteve
    Author

    I created the dummy sshd service as described.

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

  5. ajrock commented on Oct 3, 2019

    @ajrock

    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!

  6. LukeCarrier commented on Feb 24, 2020

    @LukeCarrier

    Manoj Ampalam (@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.

  7. ISkomorokh commented on Jun 30, 2020

    @ISkomorokh

    The workaround is still relevant in July 2020!

  8. bagajjal commented on Jun 30, 2020

    @bagajjal
    Collaborator

    Igor Skomorokh (@ISkomorokh) - The fix be part of next windows release which is available in fall timeframe this year.

  9. 4 remaining items

  10. thomassuckow commented on Nov 13, 2020

    @thomassuckow

    You can also just install the OpenSSH server windows feature to mitigate this issue even if you never start the openssh server service.

  11. rbreaves commented on Nov 24, 2020

    @rbreaves

    Still relevant sadly and yes the workaround above does work, cs.exe wrapper. Feels like this should have been a pretty high priority awhile ago, but at least there's indication that the fix is coming.

  12. moaxcp commented on Jan 13, 2021

    @moaxcp

    Just ran into this and the workaround fixed it. Thanks!

  13. cconrad commented on Feb 5, 2021

    @cconrad

    Still a good workaround in February 2021. Thank you

  14. valentinovamsi commented on Feb 9, 2021

    @valentinovamsi

    worked like a charm, thank you :)

  15. ferdinandosimonetti commented on Feb 15, 2021

    @ferdinandosimonetti

    Windows 10 20H2 build 19042.746.
    Last friday my SSH Agent worked like a charm.
    Today, I had to install OpenSSH Server to get rid of the
    error fetching identities: communication with agent failed

  16. dsisnero commented on Feb 22, 2021

    @dsisnero

    Still needed workaround

  17. yangruan commented on Mar 3, 2021

    @yangruan

    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

    I had to run powershell as administrator to run this, but then I could ssh-add in any other powershell terminal.

  18. wcarson commented on Mar 3, 2021

    @wcarson

    March 2021...workaround still needed and still works

  19. cima commented on Mar 17, 2021

    @cima

    ssh-add used to work until last week, this week it needs the workaround. This issue needs to be reopened.

  20. LeszekKalibrate commented on Apr 22, 2021

    @LeszekKalibrate

    winver 20H2
    Applied fix and Github is working now, but getting error in BASH cmd now:

    $ git pull
    CreateProcessW failed error:193
    ssh_askpass: posix_spawn: Unknown error
    [email protected]: Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
  21. jbanks9 commented on Nov 8, 2021

    @jbanks9

    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

    HAY I know this is old, hope you are still around. When I tried using the work around with my local user path I got the error:

    [SC] OpenSCManager FAILED 5: Access is denied.

    Do you know how I am able to fix this error?

  22. Spaxe commented on Nov 25, 2021

    @Spaxe

    Hi Nia Newton (@jbanks9) you need to run PowerShell with Administrator privileges. It worked for me just now.

  23. SlinkySlonkyOlivia commented on Jan 22, 2023

    @SlinkySlonkyOlivia

    Sorry to revive this thread; but the workaround unfortunately did not work for me, despite running in admin priv...
    It only told me the service already exists, and ssh-add -l still no worky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions