MongoDB Documentation, Release 3.0.4 To change your own password, you must have the changeOwnPassword (page 419) action (page 419) on your database. See Change Your Password and Custom Data (page 396). Step 1: Connect to MongoDB with the appropriate privileges. Connect to the mongod or mongos with the privileges specified in the Prerequisites (page 395) section. The following procedure uses the siteUserAdmin created in Create a User Administrator (page 384). mongo --port 27017 -u siteUserAdmin -p password --authenticationDatabase admin Step 2: Change the password. Pass the user’s username and the new password to the db.changeUserPassword() method. The following operation changes the reporting user’s password to SOh3TbYhxuLiW8ypJPxmt1oOfL : db.changeUserPassword("reporting", "SOh3TbYhxuLiW8ypJPxmt1oOfL") Changed in version 2.6. Users with appropriate privileges can change their own passwords and custom data. Custom data (page 417) stores optional user information. Considerations To generate a strong password for use in this procedure, you can use the openssl utility’s rand command. For example, issue openssl rand with the following options to create a base64-encoded string of 48 pseudo-random bytes: To modify your own password and custom data, you must have privileges that grant changeOwnPassword (page 419) and changeOwnCustomData (page 419) actions (page 419) respectively on the user’s database. Step 1: Connect as a user with privileges to manage users and roles. Connect to the mongod or mongos with privileges to manage users and roles, such as a user with userAdminAnyDatabase (page 412) role. The following procedure uses the siteUserAdmin created in Create a User Administrator (page 384). mongo --port 27017 -u siteUserAdmin -p password --authenticationDatabase admin openssl rand -base64 48 Prerequisites Overview Change Your Password and Custom Data Procedure Chapter 6. Security 396