Created
September 9, 2022 18:48
-
-
Save froboy/d2ca8af58581c66816901fa3003ba673 to your computer and use it in GitHub Desktop.
Bash script to bulk reset Drupal user passwords using drush
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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