benpye / wsl-ssh-pageant

A Pageant -> TCP bridge for use with WSL, allowing for Pageant to be used as an ssh-ageant within the WSL environment.
BSD 2-Clause "Simplified" License
612 stars 40 forks source link

WSL SSH doesn't check win-pageant for key #59

Closed jeffbrl closed 1 year ago

jeffbrl commented 1 year ago

I have a private key loaded in win-pageant at startup that I want to use within WSL. wsl-ssh-pageant worked for me until a few weeks ago. Note that I cannot rule out that I changed something on my end.

I am running wsl-ssh-pageant as follows.

C:\portables\wsl-ssh-pageant-amd64-gui.exe -systray -verbose -wsl C:\Users\jeffl\Documents\ssh-agent.sock

pageant runs at startup and successfully loads my key after I type the passphrase.

Within WSL bash, I am exporting the variable.

export SSH_AUTH_SOCK=/mnt/c/Users/jeffl/Documents/ssh-agent.sock

I expect to see the key loaded when I type 'ssh-add -L' in WSL.

jeffl@DELLT20:~$ ssh-add -L
Error connecting to agent: Connection refused
jeffl@DELLT20:~$

Are my assumptions incorrect? What is going wrong here?

mgrant0 commented 1 year ago

I too am fighting the same issue.

I start wsl-ssh-pageant-amd64-gui from Start-up like this:

E:\OneDrive\Documents\Bin\wsl-ssh-pageant-amd64-gui.exe --wsl C:\Users\mgran\AppData\Local\Temp\ssh-agent.sock --winssh ssh-pageant --systray

I see the orange icon of the WSL-SSH-Pageant running in the system tray.

From WSL2:

[my-pc ~ $159] echo $SSH_AUTH_SOCK
/mnt/c/Users/mgran/AppData/Local/Temp/ssh-agent.sock
[my-pc ~ $160] ssh-add -L
Error connecting to agent: Connection refused

Any ideas?

benpye commented 1 year ago

If you're using WSL 2 you'll need to use the socat approach rather than the wsl argument. Unfortunately we can't have pipes between WSL 2 and Windows. I think this should be covered by #33

jeffbrl commented 1 year ago

The suggestion to use socat in #33 is difficult for me to parse. I followed the instructions at https://github.com/BlackReloaded/wsl2-ssh-pageant which I don't fully understand but it seems to work.