Resetting a User's Password

If you have access to the Moodle application server, you can use the admin/cli/reset_password.php command to reset passwords for users with the manual authentication method.

To run this script (from the moodle root code directory), you may need to sudo as a user with write privileges to the $CFG->dataroot directory.

php admin/cli/reset_password.php

== Password reset ==
Enter username (manual authentication only)
: moodlewiki
Enter new password
: moodlewiki
NOTE: the password you specified has to match the password rules configured in Moodle.

For example the above password moodlewiki would not be secure enough and by default would throw this error:

Passwords must have at least 1 digit(s).
Passwords must have at least 1 upper case letter(s).
Passwords must have at least 1 non-alphanumeric character(s) such as as *, -, or #.

Very handy if you are unable to get into the Moodle site for any reason, or need a quick way to reset a user’s password.

No Comments
Back to top