Change a User’s Password¶
Changed in version 2.6.
Strong passwords help prevent unauthorized access, and all users should have strong passwords. You can use the openssl program to generate unique strings for use in passwords, as in the following command:
openssl rand -base64 48
You must have the changeAnyPassword action on a database to modify the password of any user on that database.
Connect to MongoDB with the appropriate privileges.¶
The following procedure uses the siteUserAdmin created in Create a User Administrator.
mongo --port 27017 -u siteUserAdmin -p password --authenticationDatabase admin