Forum Discussion

B0rg's avatar
B0rg
Frequent Contributor
4 years ago

Generate passwords from op 1P CLI?

Is it possible to add command to generate random passwords from the 1P CLI?
Add the https://1password.com/password-generator/ web version also to the "op" command.

Like:
~/home>op --genpass aB! 12
Generates a Password with a length of 12 character with lowercase UPPERCASE and symbols.


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

7 Replies

  • andi_t_1P's avatar
    andi_t_1P
    Icon for 1Password Team rank1Password Team

    Hi gtirloni and thank you for following up on this! As we do not currently support a straight up alternative to pwgen we do provide a (slightly longer but more comprehensive) solution for generating a password AND saving it for future use:

    Use the '--generate-password' option to generate and set a random
    password for a Login or Password item. By default, it will create a
    32-character password made up of letters, numbers, and symbols.

    You can customize the password with a password recipe. Specify the
    password length and which character types to use in a comma-separated
    list. Ingredients are:

    • 'letters' for uppercase and lowercase letters
    • 'digits' for numbers
    • 'symbols' for special characters ('!@.-_*')
    • '1' - '64' for password length

    Example for your use case:

    op item create --title='retrievable generated password' --category=password --generate-password=20,letters,digits | op read op://Private/'retrievable generated password'/password

    This should achieve your desired output and furthermore it will store your password for further retrieval at any later stage using the op read [secret_reference] command.

    Hope this helps!

    All the best,
    Andi

  • gtirloni's avatar
    gtirloni
    New Contributor

    Hi, any updates on this? It would be nice to use a password generator blessed by 1Password.

  • Former Member's avatar
    Former Member

    Thanks for the follow-up! We'll make sure to update this thread once we have any developments on this front.

    Best,
    Horia

  • B0rg's avatar
    B0rg
    Frequent Contributor

    @"Horia.Culea_1P" Thank you for your reply.
    I just want to create a password not a item in 1P using the CLI. And make a Alfred workflow so the passwords i create are only made by 1P and not pwgen or other password creator sites/tools.

  • Former Member's avatar
    Former Member

    Heya!

    Thank you for reaching out to us!
    Currently, the only way to generate such passwords with the 1Password CLI is with op item create.
    Can you please let us know more about your use-case, that would make use of this feature?
    For what it's worth, we do have an internal ticket that tracks adding such functionality.
    Looking forward to hearing from you!

    Best,
    Horia