My ssh keys are stored in KeepassXC (version 2.7.1). I've enabled the SSH Agent integration in KeepassXC and have it use OpenSSH. I tried using Pageant and with "Use both agents" but it doesn't work as it fails to connect to the ssh agent. The KeepassXC is installed on my Windows 10.
I have OpenSSH Authentication Agent running, started and on automatic. With all of this setup, I can see that the keys are loaded by doing ssh-add -l
in my powershell.
Following the README guide from this repo https://github.com/rupor-github/wsl-ssh-agent, I have:
- Installed
socat
in WSL2 - Installed
wsl-ssh-agent.exe
and running in Windows 10. - Stored
npiperelay.exe
in Windows 10 partition (currently in Documents folder). - And added to the bottom of my
.zshrc
file:
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
ss -a | grep -q $SSH_AUTH_SOCK
if [ $? -ne 0 ]; then
rm -f $SSH_AUTH_SOCK
(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"/mnt/c/Users/myusername/Documents/wsl-ssh-agent/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork &) >/dev/null 2>&1
fi
- Ran and restarted my shell with
exec zsh
or closed and reopened my terminal and tested withssh-add -l
but I get this error message:
error fetching identities: communication with agent failed
I have also tried restarting my KeepassXC and OpenSSH agent service, same error. But I can confirm that the keys are still loaded via my powershell with ssh-add -l
.
What am I doing wrong?
Update: My WSL2 is a Debian.
> cat /etc/debian_version
11.3
> ssh -V
OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1n 15 Mar 2022
My Windows 10
PS C:\WINDOWS\system32> ssh -V
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
Could it be because of the OpenSSH version difference causing the problem?
Update2:
I was able to update my OpenSSH in Windows 10 to the latest version thanks to an answer at a separate question here: https://superuser.com/a/1609071/830668
PS C:\WINDOWS\system32> ssh -V
OpenSSH_for_Windows_8.9p1, LibreSSL 3.0.2
Restarted and tested, the error persists.