6

Windows 10 20H2, build 19042.685

I'm trying to use the SSH agent in the built-in OpenSSH client on Windows 10. The agent is running:

C:\Users\Daniel> Get-Service | ?{$_.Name -like '*ssh-agent*'} Status Name DisplayName ------ ---- ----------- Running ssh-agent OpenSSH Authentication Agent 

However, ssh-add is still throwing the same error:

C:\Users\Daniel> ssh-add C:\Users\Daniel\.ssh\id_ed25519 Error connecting to agent: No such file or directory 

Any ideas?

1
  • I have the same problem, seems to have started after I moved the Windows TEMP folder from C: to D: (using Windows10's correct ways of doing this) in a folder with a space in the name. Everything works, all apps, except for ssh-agent which now appears to be completely broken - I suspect some obvious bug in ssh on windows. Commented Feb 4, 2021 at 17:18

1 Answer 1

2

I found that something in Windows10 is setting the path to ssh-agent as an env-var, but cannot cope with spaces in foldernames. Someone forgot to escape their inputs! (AAAAAAAARRRRGGGGH!).

To test: (in git-bash, which I'm currently using)

echo "$(ssh-agent)" 

...gives what your env has setup (in my case: stupidly) for how it will find/access ssh-agent. I got:

SSH_AUTH_SOCK=/d/Windows10 Temporary Files/ssh-XXXXXXX/agent.YYYYY; export SSH_AUTH_SOCK; SSH_AGENT_PID=54456; export SSH_AGENT_PID; echo Agent pid 54456; 

...oh look! Someone forgot that folders can have spaces, and didn't bother to escape their inputs (the first line is corrupt, it includes the "export" command).

Re-exporting that env-variable correctly (wrap the "/d/...YYYY" with single quotes, remove the trailing ";", and remove the "export SSH_AUTH_SOCK;" part) causes ssh-agent to work properly again.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.