---
canonical: https://solariz.de/posts/17/ubuntu_subsystem_windows_und_keepass_keeagent_page/index.md
---> Hey, just a heads-up that this content is based on an automatically imported version from our old CMS. If the formatting isn't perfect, I'm sorry about that.

![Title Image: Ubuntu Subsystem Windows und Keepass KeeAgent / pageant](https://solariz.de/images/17/windows-ubuntu-linux-subsystem-1502829290.jpg "Title Image: Ubuntu Subsystem Windows und Keepass KeeAgent / pageant")

- * This is an updated posting from [my older German Article](https://tcpip.wtf/en/posts/811/ubuntu-subsystem-windows-und-keepass-keeagent-pageant.htm). **I don't want to give a rating of the Subsystem for Linux; for some, it is very useful; others may not be so happy about it, but let's get straight to the point.

The most pain I had was having my private key in the Subsystem and needing to re-authenticate every time by entering the key. I'm used to using the Keepass integrated (plugin) Agent, and that's why my key has a password that's too long to type.

In Ubuntu for Windows, the native pageant support from a Pagent initialized in Windows is not possible because the system "lives" within another layer of the OS.

The solution is an Agent Helper.

## Installation

1.  Download the latest ZIP Files of Vuoris pagent from the [Release Seite](https://github.com/vuori/weasel-pageant/releases).
2.  Extract into a Folder which can be accessed from within your WSL Linux.

    Therefore, I created an extra directory in my Windows User homedir. I added that directory as a symbolic Link to my WSL. See Screenshot:

    ![Konsole SSH Linux Subsystem Windows Bash Ubuntu](https://solariz.de/images/17/linux_windows_ubuntu_console_subsystem.png "Konsole SSH Linux Subsystem Windows Bash Ubuntu")

3.  Edit the **.bashrc** in your WSL Homedir.
4.  Add the following Code at the end; please adjust the Agent Path (/mnt/c/Users/mg/…).

```bash
# using pagent / Keepass for Authentication
# see: https://tcpip.wtf/en/linux-ubuntu-subsystem-windows-keepass-keeagent-pageant.htm

# Getting exec location
# I use this script on several Computers, to easy have it copy and paste
# I added those "Path finding"...
# If you know the Path is fixed for you, just set it as WEASEL 
if [ -f "/mnt/c/path-to-pageant/weasel-pageant-1.4/weasel-pageant" ]; then
	WEASEL="/mnt/path-to-pageant0/weasel-pageant-1.4/weasel-pageant"
elif [ -f "/mnt/d/another-path-to-pageant/weasel-pageant-1.4/weasel-pageant" ]; then
	WEASEL="/mnt/d/another-path-to-pageant/weasel-pageant-1.4/weasel-pageant"
elif [ -f "/mnt/e/another-path-to-pageant/weasel-pageant-1.4/weasel-pageant" ]; then
	WEASEL="/mnt/e/another-path-to-pageant/weasel-pageant-1.4/weasel-pageant"
fi

if [ -f "$WEASEL" ]; then
	echo -n "pageant:"
    # killing old running socket
	"$WEASEL" -k >/dev/null 2>/dev/null
    # starting new
	eval $($WEASEL -r -q) >/dev/null 2>/dev/null
	sshkeysloaded=$(ssh-add -l|grep -c SHA)
	if [[ $sshkeysloaded -gt 0 ]] ; then
	    echo -e "\e[92m OK, ready for Agent forward, loaded $sshkeysloaded keys."
	else
	    echo -e "\e[91m Fail, no keys found or pageant connection failed. "
	fi
	echo
fi
```

That's actually all. As soon as you start a new WSL, the .bashrc gets loaded, and weasel PAGEANT loads the Keys provided within your Windows Pageant environment.

![KeeAgent for Keepass](https://solariz.de/images/17/keeagent-keepass-windows-ssh-86389.png "KeeAgent for Keepass")

