Ssh fails to use private key from ssh-agent: communication with agent failed
Asked Answered
L

2

8

I'm getting an error when using ssh, which tries to use keys from ssh-agent, but fails with this message (when running ssh -v):

debug1: get_agent_identities: ssh_fetch_identitylist: communication with agent failed

Full log

I can see both of my keys added to the agent when running ssh-add -l:

$ ssh-add -l
3072 SHA256:0i3sqR60WRsAOpFVJyw951NUDW01jkAWFB1na921Asd xxxxxx@somehost (RSA)
4096 SHA256:CG6njka821AOd82j1xGFkyiOjwG/yo921KAIOWm3t/4 xxxxxx@anotherhost (RSA)

The same error appears with no keys or one key inside the agent.

I'm running the fish shell on Archlinux, and also tried this under bash, but it doesn't seem to make a difference. The same setup was working for me on Ubuntu. There seem to be no questions about this exact issue, and I'm stuck with no clues.

Lamson answered 8/3, 2022 at 17:41 Comment(2)
I believe this problem was caused by a bug in the newest version of OpenSSH (8.9p1-1). I rolled back to version 8.8p1-1 and it seems to have resolved the issue. I will check the a newer version once it's released, but for now I'm going to suggest rolling back if there are any unknown issues.Lamson
This question is not related to SO as it is not a programming question!Owain
W
27

I found that this problem on my pc is caused by the windows default ssh client which stores my ssh key files. After upgrading to 8.9 with https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v8.9.0.0p1-Beta I solved this problem.

Willowwillowy answered 19/3, 2022 at 11:38 Comment(6)
The problem for me indeed was that ssh 8.9p1 from Ubuntu 22.04 on WSL could not connect to the 8.0p1 version that shipped with Windows. By downloading and installing the newer version manually my issue was fixed.Sketch
Awesome, thank you for sharing this. This is not just wsl related, if you go to Ubuntu 22 with Windows default SSH as of now it breaks as per OP, and the latest installer fixes the issue. I had to remove the built-in ssh and put the installed ssh onto the PATH, because installer does not do it automatically for some reason.Chesterton
I finally stumbled upon this today. I just updated my windows using the .msi file and rebooted and it worked. It looks like it installed to C:\Program Files\OpenSSH\ssh.exe and updated the path to put that first.Breadboard
This works nicely. But when I do ssh -V afterwards, it says I have 8.6p1 -- why?Unthinkable
@Unthinkable the default version of Win11 is 8.6p1. To use the newly installed version, you may add the dir to path, checkout Install-Win32-OpenSSH-Using-MSIWillowwillowy
instead of rebooting after installing the MSI, you can just do this from an admin powershell terminal: Restart-Service ssh-agentDup
U
1

You can also use beta channel for OpenSSH windows version.

In a powershell with admin rights :

Remove-WindowsCapability -Online -Name OpenSSH.Client
winget install Microsoft.OpenSSH.Beta --override ADDLOCAL=Client

And restart your windows agent. This will install and use a new version of OpenSSH in program files.

Uninspired answered 23/4 at 9:31 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewAskja

© 2022 - 2024 — McMap. All rights reserved.