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

Contact Us