Signing back into the Community for the first time? You'll need to reset your password to access your account. Find out more.
Forum Discussion
anishlr
3 years agoNew Contributor
Is it possible for 1Password CLI running on WSL to connect with 1Password hosted on Windows?
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...
Former Member
3 years agoYou 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"