One of the notable features of 1Password is the ability for the service to act as an SSH agent, replacing local storage of private keys. At work, I use Ubuntu 22.04 inside of WSL2 for all of my development tasks, which has been a huge boon to my productivity.
However, the documentation provided by 1Password is limited and does not clearly cover the use case of setting it up on a Windows host with a WSL2-powered Ubuntu instance. After spending a couple of hours today trying to figure it out, I finally have a solution.
Note: I’m running Windows 10. Some steps may be unnecessary on Windows 11 systems.
How to set it up
Here are the steps I took that ended up working. Some may be optional for you and I haven’t extensively tested other methods. As always, YMMV.
- Install Scoop. You’ll need this for both
npiperelay
andopenssh
. Technically, you can install these withoutscoop
, but it’s far easier to do with the utility. - Uninstall the Windows OpenSSH client. To do this, open Windows Search and look for “Optional Features.” Remove
OpenSSH Client
.
The officially provided Windows is out-of-sync with the version shipped in Ubuntu 22.04. - Install OpenSSH 8.9.1p0. You can do this by running the following command:
scoop install openssh@8.9.1p0
. - Install
npiperelay.exe
. This utility will allow us to forward pipes between the WSL2 system and our Windows host. To install:scoop install npiperelay
. - Log out and log back in. You may also need to restart Windows.
- Configure 1Password to function as an SSH Agent. You may need to first turn on “Unlock using Windows Hello” under the “Security” tab in Settings. Then navigate to “Developer > Use the SSH agent” and tick the box to turn on the SSH agent.
- Follow these steps from
d4vsanchez
to finish the setup inside of your Ubuntu WSL2 instance.
And that’s it! You should be able to verify your setup by running:
ssh-add -l
If you see a list of keys, then you’re in business.