A Weasel for WSL…

So I have been using Windows Subsystem for Linux (WSL) for a while now (specifically, the “Microsoft’ed” version of Ubuntu 18.04).

Recently, I have had to use my local desktop to handle some git stuff, and I decided to do so within WSL. First up, I ran headlong into access problems – I run PuTTY Pageant and did not want to explicitly run ssh-agent inside WSL, not to mention maintaining a duplicate of my private keys in the WSL environment(s).

Well, agent forwarding was made for a reason, so I immediately set off to find a solution.

A Bridge (Not Too Far…)

So I stumbled across two “bridges” that would bridge the gap between processes running inside WSL and the PuTTY Pageant process running on the host Windows 10:

I decided to go for the latter as it seemed less troublesome for me:

  1. dump the contents of the weasel-pageant .zip file somewhere on the host OS, accessible from within the WSL environment via DrvFS (e.g. /mnt/d/Archive/weasel-pageant)
  2. inside WSL, append the following to your ~/.bashrc, which tests for any existing weasel-pageant process, and
    • runs it (if not already running), or
    • re-set the environment variables needed (if already running)
pgrep -l weasel-pageant
if [ $? != 0 ]; then
  /mnt/d/Archive/weasel-pageant/weasel-pageant -b>/tmp/weasel-pageant.sh
  chmod u+x /tmp/weasel-pageant.sh
fi
if [ -f /tmp/weasel-pageant.sh ]; then
  . /tmp/weasel-pageant.sh
fi;

Microsoft’s Own

So, one other “solution” I found was to use Microsoft’s own ssh-agent inside of Windows 10 (negating the need to use PuTTY Pageant, BUT (and it’s a big but) any other software running on the host OS (i.e. Windows 10) also needs to be re-written to handle Microsoft’s version of an ssh-agent. Nonetheless, there exists a “bridge” for processes in WSL to access the Windows 10 ssh-agent. This is called ssh-agent-wsl (which is declared to also build off the above-mentioned weasel-pageant).

Leave a Reply