ssh-agent reset in Windows Subsystem for linux (WSL)
Solution 1
I'm copying the answer given in another similar thread (https://stackoverflow.com/a/50942800/9966057).
It's no use trying to tweak your session setup.
Full answer : 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).
Solution 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.
Related videos on Youtube
Nate
Updated on September 18, 2022Comments
-
Nate almost 2 years
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
andeval $(ssh-agent -s)
and in combinationWhy 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
-
Nate over 6 yearsTried in both the
> dev
... and simple versions -
robinCTS about 6 yearsYou answered perfectly. Providing a link is great, but you must also include the essential information, which you did.
-
G-Man Says 'Reinstate Monica' about 6 yearsYes, if you copy information written by somebody else, you must link to the source; see How to reference material written by others.