Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh-agent reset in Windows Subsystem for linux (WSL)

I am trying to use ssh-agent under WSL but the SSH params are wiped after the script is run

From .bashrc (cut down version)

eval $(ssh-agent)
ssh-add

ssh-add -l
echo "SSH_AGENT_PID is" $SSH_AGENT_PID
echo "SSH_AUTH_SOCK is" $SSH_AUTH_SOCK

Prompts for the passphrase then shows the fingerprint and relevant variables

straight after at prompt (or seperate script) running

ssh-add -l
echo "SSH_AGENT_PID is" $SSH_AGENT_PID
echo "SSH_AUTH_SOCK is" $SSH_AUTH_SOCK

gives

Could not open a connection to your authentication agent.
SSH_AGENT_PID is
SSH_AUTH_SOCK is

(tidied for readability)

the agent is still running with the original pid (checked in top) also tried eval $(ssh-agent ) > /dev/null and eval $(ssh-agent -s) and in combination

Why do these get wiped? ssh-agent worked fine until windows update 1709 "fall creators update"

for info: linux version 4.4.0-43-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #1-Microsoft Wed Dec 31 14:42:53 PST 2014

Repost from here:https://superuser.com/questions/1278539/ssh-agent-reset-in-windows-subsystem-for-linux-wsl

like image 442
Nate Avatar asked Dec 18 '22 01:12

Nate


1 Answers

This is a late answer for anybody arriving here : https://github.com/Microsoft/WSL/issues/3183

Short version : ssh-agent forwarding is broken by a getsockopt bug in wsl / ubuntu 18.04 (or any other linux I would imagine).

like image 122
babebibobu Avatar answered Dec 30 '22 20:12

babebibobu