2

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

6

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).

| improve this answer | |
4

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.

| improve this answer | |
  • Tried in both the > dev... and simple versions – Nate Dec 20 '17 at 8:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.