Is it possible for 1Password CLI running on WSL to connect with 1Password hosted on Windows?

anishlr
anishlr
Community Member

Right now I can access 1Password on my WSL Debian installation using the CLI. But I have to enter my master password even when Windows is authenticated. I was just curious if it's possible to connect the two (a-la the SSH agent forwarding magic outlined here - https://1password.community/discussion/128023/ssh-agent-on-windows-subsystem-for-linux)


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided

Comments

  • Hi @anishlr:

    There currently isn't any way of connecting 1Password CLI running in Windows Subsystem for Linux to 1Password for Windows running on the host. With that said, it's something I'd love to see too, so I'll share your feedback on an internal discussion we have about this. While I can't promise anything specifically, we use feedback like yours to help inform the future of 1Password.

    Jack

    ref: IDEA-I-1662

  • FWest98
    FWest98
    Community Member

    I would be very interested in this feature as well! Especially with the shell plugins recently introduced, that would be a great combination of being able to connect to GitLab from my WSL shell using Hello authentication.

  • Hey @FWest98:

    I've noted your interest as well. Thanks for reaching out!

    Jack

  • thisdevdane
    thisdevdane
    Community Member

    Just to add to the list of people, that is something I wish for as well.

  • Hey @thisdevdane:

    I've added you as well! 🙂

    Jack

  • mabus
    mabus
    Community Member

    +1 name for the list if it helps. :)

  • yami759
    yami759
    Community Member

    Another +1 here

  • matfax
    matfax
    Community Member
    edited January 2023

    You can use the Windows cli binary, which is already connected to the host's 1Password instance, to access the data.

    alias op="op.exe"

    Obviously, op.exe needs to be accessible via the host's PATH or the WSL's PATH, or you'll have to specify the full path to the binary in /mnt/c/.../.

    Autocomplete works as well.

    eval "$(op completion zsh)"; compdef _op op.exe

    Unfortunately, this will only work for your own scripts because the binary's plugins still run on Windows and don't recognize the Linux shell, unless the plugin supports both platforms.

    Here's a sudo alias:

    alias sudo="sudo -S <<< $(op item get YOUR_ROOT_PASS_ID --fields label=password)"

    Or, as a separate command, since sudo -S removes its interactivity.

    alias sudoauth="op item get YOUR_ROOT_PASS_ID --fields label=password | sudo -Sv"

  • Morsok
    Morsok
    Community Member

    Also very interested by that! Trying the alias to op.exe for now.

  • kajojo
    kajojo
    Community Member

    With the current lack of support for Windows side plugins (official and otherwise) it would be extremely useful to be able to get this working.

  • Hey folks,

    Thanks for sharing your interest! I know it's something I'd love to see as well, so I'll add your feedback. 🙂

    Jack

  • jefoso
    jefoso
    Community Member

    I'm also interested. Using AWS CLI with 1Pass would be great.
    Thanks

  • PurplProto
    PurplProto
    Community Member

    +1 Would love to see this as well. Seeing that 1Pass has other developer friendly features i.e the VSCode extension, secrets and ssh-agent (while unofficially supported, can be utilised in WSL) to name what first comes to mind, I think this would be a fantastic addition to the toolkit! 😊

  • Hi @PurplProto and @jefoso:

    Thanks for sharing! 🙂

    Jack

  • tisbam
    tisbam
    Community Member

    +1

    I have been using the hackish solution for ssh agent and it's a breeze. Would love seeing the full 1Password CLI working on WSL.

  • matfax
    matfax
    Community Member
    edited March 2023

    Btw, here's a new solution that doesn't depend on a separate sudoauth alias.

    Github Gist: Sudo authentication with Windows 1Password CLI on Ubuntu WSL

    The howto script is not meant for automatic execution, just as a guideline. It's best if you just edit the respective files manually, and don't forget substituting your own item identity.

  • Thanks for sharing!

    Jack

  • Barbosa
    Barbosa
    Community Member

    +1

  • redblueflame
    redblueflame
    Community Member

    +1

  • sanctusmessor
    sanctusmessor
    Community Member

    +1

  • nossair
    nossair
    Community Member

    +1

  • Thank you everyone for chiming in!

    We'll let you know once we have more details here.

  • Stanzilla
    Stanzilla
    Community Member

    Would love to see this as well

  • Cheeseiznice
    Cheeseiznice
    Community Member

    +1

  • tmill
    tmill
    Community Member

    +1

  • DimRus
    DimRus
    Community Member

    What I found is that it works if you create a symlink in your WSL machine, pointing to op.exe on your Windows host:
    ln -s /mnt/c/Users/user/AppData/Local/Microsoft/WinGet/Links/op.exe /home/user/.local/bin/op

    It works with other Linux commands (in opposite to alias), and in particular with ansible.

  • HugoImaios
    HugoImaios
    Community Member
    edited December 2023

    I also would love to see this released ! Windows co-workers wait for this !

  • davidsass
    davidsass
    Community Member

    has there been any progress since then? has any kind of roadmap been prepared?

    it would be very nice to be able to use the 1password CLI via WSL2, especially the shell plugins

  • btmurrell
    btmurrell
    Community Member

    bump. +1 for me. we all expect this to "just work". for me, the ability to have a real shell vis a vi WSL is the only reason this programmer is using Windows. To my understanding, there's a pipeline btwn the WSL environment and Windows (be it ports or binary compatibility), but having op cli available in WSL, connecting to the Windows 1p app is a critical piece.

  • acjay
    acjay
    Community Member

    This would be huge. I have currently adopted @matfax's solution, which works. I haven't used any CLI plugins yet. But generally, I think having a turnkey solution for WSL would be really useful.