I am on Windows 11 and ssh works fine in WSL2 but I can't seem to get the gpg side to work. I have gpg4win installed via chocolatey. I am using this:
# Utilize Yubikey and SSH from Windowswsl2_ssh_pageant_bin="$HOME/.ssh/wsl2-ssh-pageant.exe"if[[!-f"${wsl2_ssh_pageant_bin}"]];then
windows_destination="/mnt/c/Users/Public/Downloads/wsl2-ssh-pageant.exe"if[[!-f"${windows_destination}"]];then
wget -O"$windows_destination""https://github.com/BlackReloaded/wsl2-ssh-pageant/releases/latest/download/wsl2-ssh-pageant.exe"# Set the executable bit.chmod +x "$windows_destination"fi# Symlink to linux for ease of use laterln-s$windows_destination$wsl2_ssh_pageant_binfi
export SSH_AUTH_SOCK="$HOME/.ssh/agent.sock"if! ss -a | grep-q"$SSH_AUTH_SOCK";then
rm-f"$SSH_AUTH_SOCK"if test-x"$wsl2_ssh_pageant_bin";then(setsid nohup socat UNIX-LISTEN:"$SSH_AUTH_SOCK,fork" EXEC:"$wsl2_ssh_pageant_bin">/dev/null 2>&1 &)else
echo>&2 "WARNING: $wsl2_ssh_pageant_bin is not executable."fi
fi
export GPG_AGENT_SOCK="$HOME/.gnupg/S.gpg-agent"if! ss -a | grep-q"$GPG_AGENT_SOCK";then
rm-rf"$GPG_AGENT_SOCK"windows_username=$(cmd.exe /c echo %USERNAME% 2>/dev/null | tr-d'\r')# When gpg4win is installed with scoop or chocolatey, the pipe is in the local directoryif[-d"/mnt/c/Users/$windows_username/AppData/Local/gnupg"];then
config_path="C:/Users/$windows_username/AppData/Local/gnupg"else
config_path="C:/Users/$windows_username/AppData/Roaming/gnupg"fi
if test-x"$wsl2_ssh_pageant_bin";then(setsid nohup socat UNIX-LISTEN:"$GPG_AGENT_SOCK,fork" EXEC:"$wsl2_ssh_pageant_bin -verbose --gpgConfigBasepath ${config_path} --gpg S.gpg-agent">/dev/null 2>&1 &)else
echo>&2 "WARNING: $wsl2_ssh_pageant_bin is not executable."fi
unset windows_username config_path
fi
unset wsl2_ssh_pageant_bin
I am pretty sure I have every package anyone in any debugging thread has mentioned:
$ apt list --installed |grep 'gpg\|scdaemon\|iproute2'
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
gpg-agent/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed,automatic]
gpg-wks-client/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed,automatic]
gpg-wks-server/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed,automatic]
gpg/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed,automatic]
gpgconf/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed,automatic]
gpgsm/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed,automatic]
gpgv/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed,automatic]
iproute2/jammy,now 5.15.0-1ubuntu2 amd64 [installed]
libgpg-error0/jammy,now 1.43-3 amd64 [installed,automatic]
libgpgme11/jammy,now 1.16.0-1.2ubuntu4 amd64 [installed,automatic]
scdaemon/jammy-updates,jammy-security,now 2.2.27-3ubuntu2.1 amd64 [installed]
I am on Windows 11 and ssh works fine in WSL2 but I can't seem to get the gpg side to work. I have gpg4win installed via chocolatey. I am using this:
I am pretty sure I have every package anyone in any debugging thread has mentioned:
Here's info on my install of WSL also:
Anyone have any idea why this isn't working?