Skip to content

Instantly share code, notes, and snippets.

@froboy
Created September 9, 2022 18:48
Show Gist options
  • Save froboy/d2ca8af58581c66816901fa3003ba673 to your computer and use it in GitHub Desktop.
Save froboy/d2ca8af58581c66816901fa3003ba673 to your computer and use it in GitHub Desktop.
Bash script to bulk reset Drupal user passwords using drush
#!/usr/bin/env bash
set -e
set -x
# Space separated list of usernames
users=(user1 user2 [email protected])
for user in ${users[@]}; do
password=$(echo $RANDOM | md5sum | head -c 20);
# use fin, ddev or whatever your tool's prefix to drush and set an alias if necessary
drush @site.environment user:password "$user" "$password"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment