Mass Reset WordPress User Passwords

I wrote a simply Bash script to reset all WordPress user passwords, enjoy

Basically, all users from the database are retrieved and put in an array then a random password is generated on line 6, password is reset on line 7, retrieve the users email on line 9 then finally send the user an email with the new username and password on line 10. You also want to echo back the username and password that was set in case you need that for your records

Replace with the name of the database, also the script assumes you are connecting with a user that has its MySQL password in ~/.my.cnf so no user or password options are specified for MySQL, if you have to specify a user and password, change the lines with mysql to

Change to the MySQL user and to the MySQL user


Mass reset Linux shell passwords

The passwd utility on Linux by default runs in interactive mode and it makes it difficult to reset shell passwords for a large number of users. I found the one liner below to be very helpful in accomplishing this task

Each user with an active shell will have that as part of the entry in /etc/passwd. So we are basically searching for each user with shell /bin/bash, excluding user root and resetting their passwords. We generate a random password using

and once the password change is successful, we print the username and password to the terminal


Yum and rpm commands hang

I recently encountered an issue where yum and rpm commands were hanging. For instance the command below does nothing and can hardly be killed using Crtl + C.

To resolve the issue, clear the database for yum and rebuild it by running the following commands

Contact Us