Guide: How to get 1Password working with WSL2, Ubuntu 22.04 and SSH

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.

  1. Install Scoop. You’ll need this for both npiperelay and openssh. Technically, you can install these without scoop, but it’s far easier to do with the utility.
  2. 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.
  3. Install OpenSSH 8.9.1p0. You can do this by running the following command:
    scoop install openssh@8.9.1p0.
  4. Install npiperelay.exe. This utility will allow us to forward pipes between the WSL2 system and our Windows host. To install: scoop install npiperelay.
  5. Log out and log back in. You may also need to restart Windows.
  6. 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.
  7. 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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: