The instructions below are based on rupor-github/wsl-ssh-agent and benpye/wsl-ssh-pageant/issues/33.
Install dependencies:
sudo apt update && sudo apt install socat p7zip-fullGet npiperelay.exe, store it on the Windows side and make it
available in Linux with correct permissions.
- replace
{username}with your Linux username (e.g.whoami) - replace
[USER]with your Windows username
cd /tmp
wget https://github.com/jstarks/npiperelay/releases/download/v0.1.0/npiperelay_windows_386.zip
7z e -y /tmp/npiperelay_windows_386.zip
sudo cp npiperelay.exe /c/Users/[USER]
sudo chmod +x /c/Users/[USER]/npiperelay.exe
sudo chown {username}:{username} /c/Users/[USER]/npiperelay.exeYou can check which Windows named pipes exist (with "ssh" in name) using Powershell:
[System.IO.Directory]::GetFiles("\\.\\pipe\\") | Select-String -Pattern sshGet wsl-ssh-agent-relay and store it correct permissions:
cd /tmp
wget https://raw.githubusercontent.com/rupor-github/wsl-ssh-agent/master/docs/wsl-ssh-agent-relay
sudo cp wsl-ssh-agent-relay ~/.local/bin/
sudo chmod +x ~/.local/bin/wsl-ssh-agent-relay
sudo chown {username}:{username} ~/.local/bin/wsl-ssh-agent-relayEdit wsl-ssh-agent-relay and modify paths to npiperelay.exe and wsl-ssh-agent.sock:
nano ~/.local/bin/wsl-ssh-agent-relayEdit:
- replace
[USER]with your Windows username
RELAY_BIN="/c/Users/[USER]/npiperelay.exe"
WSL_AGENT_SSH_SOCK="${HOME}/.ssh/wsl-ssh-agent.sock"Prepare SSH directory:
mkdir -m 700 -p ~/.sshUpdate ~/.bashrc to auto-start relay and socat pipe:
nano ~/.bashrc- replace
[USER]with your Windows username
${HOME}/.local/bin/wsl-ssh-agent-relay start
export SSH_AUTH_SOCK=${HOME}/.ssh/wsl-ssh-agent.sock
setsid nohup socat EXEC:"/c/Users/[USER]/npiperelay.exe //./pipe/\ssh-pageant" \
UNIX-LISTEN:${SSH_AUTH_SOCK},unlink-close,unlink-early,fork \
>/dev/null 2>&1 &Reload ~/.bashrc bashrc:
source ~/.bashrcTest:
ssh-add -l
> 2048 SHA256:
> ...