Can I pass the key and my master password to the CLI from a file?

edited November 2018 in CLI

I want to write a script to automate backup of our 1Password login details on an ubuntu 16.04 server.

op signin [email protected]

Is there a way to pass my secret key and master password from a file or do I need to use expect?

1Password Version: CLI 0.5.4
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided


  • cohixcohix

    Team Member

    It is possible;

    cat masterpassword.txt | op signin [domain] [email] $(cat secretkey.txt)

    However I strongly urge you not to leave your master password unencrypted on disk. If there's some other encryption scheme you can use such as GPG with ubuntu's keychain, that would be vastly better than an unencrypted file.

    Also, once you've signed in once, you can use op signin mydomain as a shorthand, since your domain, email, and secret key are saved in the CLI config file in ~/.op/config

This discussion has been closed.