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 () (gcc version 5.4.0 (GCC) ) #1-Microsoft Wed Dec 31 14:42:53 PST 2014

2 Answers

I'm copying the answer given in another similar thread ().

It's no use trying to tweak your session setup.

Full answer :

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

2

Try to add the -s parameter, like in :

eval $(ssh-agent -s)

This parameter is described as :

-s Generate Bourne shell commands on stdout. This is the default if SHELL does not look like it's a csh style of shell.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like