I'm using Ubuntu 18.04 on WSL (Windows 10 1803, Build 17134.112), and lately I've noticed an issue with ssh-agent.

When I start up a shell, before connecting to anything over SSH, I first call ssh-add. Then I go on connecting to something as usual. However, once I exit that SSH session to return to my own shell, I find that trying to open any SSH session prompts me for my passphrase, and ssh-add complains that the agent refused the connection.

In ps however, I find that the instance with the PID I've seen calling ssh-agent is still live. Checking the corresponding directory in /tmp also shows that the socket file still exists.

I'm confused why a live agent instance would suddenly refuse connections, and that only after exactly one use of the agent.


This seems to be caused by a bug in WSL, see this link for answer: https://github.com/Microsoft/WSL/issues/3183

In short, it seems to happen when ForwardAgent is set to yes.

  • Thanks, removed the ForwardAgent yes line from my .ssh/config block for that specific host and it works again. – FallenWarrior Jun 30 '18 at 12:37

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.