How to reset Drupal password for a number of users?

If you need to mass reset the password for your Drupal users, drush can help you. The drush command to reset a user’s password is:

drush upwd username --password="newpassword"

Now, let’s say you need to reset 100 user’s passwords.

  1. Create a file named accounts with all usernames you want to reset , one user per line.
  2. Run any of the following command:
while read line; do drush upwd "$line" --password="newpassword"; done < accounts.txt
for i in $(cat accounts); do echo update password for $i; drush upwd $i --password="newpassword"; done
Share Button

Leave a comment

Your email address will not be published. Required fields are marked *