Forum Discussion

khaosspawn's avatar
khaosspawn
Dedicated Contributor
5 years ago

Mass Update Logins/Passwords

Hi There - I have the use case were I have multiple demo/sample accounts to log into a system. eg. dave, vicki, john - and all these accounts have the same password which is changed every few days.

Is there any way I can bulk update all the passwords in 1Password for these logins?


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

7 Replies

  • Former Member's avatar
    Former Member

    Hey khaosspawn ,
    Looks like you built a nice script there!

    If you want to automate it a bit further, instead of manually listing every username, try using tags:

    1. Add a unique tag to all affected items (e.g. "NeedsPasswordChange").
    2. In the script, list all items that contain that tag: op list items --tags NeedsPasswordChange
    3. Instruct the script to grab the UUID of each item in the output of the above command and store it in the array in the script, then run the rest of the script.

    You might also add some other flags to make it faster/more efficient. For example, if you specify in which vault the items are in, it will retrieve them quicker because it won't go over all vaults in the account, so add --vault NameOfVault to the command in step #2.

    Adding the --cache flag will also further enhance performance as it will cache all the data temporarily in your computer instead of having to call our servers for every command, so add that flag as well to the command in step #2. Use the --cache flag in every op command afterwards to keep using the (temporary) locally stored data.

    Eventually the command would like similar to this: op list items --tags NeedPasswordChange --vault NameOfVault --cache

  • khaosspawn's avatar
    khaosspawn
    Dedicated Contributor

    I had an attempt to write up a script to update a bunch of items. Happy to get any feedback for automating grabbing all the user names from a vault (I'd just hard coded them for now).

    #!/bin/zsh

    #
    # Update the demo passwords in 1password.
    #

    # Define our variables
    new_password="THIS IS THE NEW PASSWORD"
    user_names=(
    "aa"
    "bb"
    "cc"
    "dd"
    )
    vault="Vault A"

    # Sign in
    # In case the details aren't stored use the command below to initialize it
    # op signin abc.1password.com abc@def
    eval $(op signin abc)

    # Let's update all the users
    for user_name in "${user_names[@]}"; do
    echo "Updating: $user_name"
    op edit item "$user_name" --vault "${vault}" password=$new_password
    echo "Update complete"
    done

    op signout

  • Former Member's avatar
    Former Member

    khaosspawn:

    The team suggested I share with you this section of the documentation:

    https://support.1password.com/command-line-reference/#edit-item

    I'm guessing I'd need to put all the affected items into a specific vault or add a tag.

    Adding a tag sounds like a good way to mark all of the items you want to update, since you also can filter based on that using the --tags tags option:

    https://support.1password.com/command-line-reference/#list-items

  • khaosspawn's avatar
    khaosspawn
    Dedicated Contributor

    Thanks @ag_ana! Will be very helpful to review some examples. I'm guessing I'd need to put all the affected items into a specific vault or add a tag.

  • Former Member's avatar
    Former Member

    khaosspawn:

    Sure, I have moved the discussion to the CLI section of the forum, and I have reached out to the team to see if they have any examples :+1:

  • khaosspawn's avatar
    khaosspawn
    Dedicated Contributor

    If you could perhaps supply some examples on how to go about this - that would be very helpful. I didn't know there was a CLI.

  • Former Member's avatar
    Former Member

    Hi khaosspawn!

    You cannot do this directly in the 1Password apps I am afraid. You could however perhaps be able to do it with the CLI:

    https://support.1password.com/command-line/

    Especially if the passwords change every few days, you might be able to automate this. I am not a developer, but if you have any specific questions I can ask some team members :+1: