Last active
September 3, 2015 21:56
-
-
Save ps/25f50a34c04e95c0a278 to your computer and use it in GitHub Desktop.
Authenticating Mongo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. mongo | |
2. use <your-database-name-here> | |
3. db.addUser('pawel','test') | |
4. exit | |
5. vim /etc/mongodb.conf uncomment the line '#auth=true' | |
6. sudo service mongodb stop | |
7. sudo service mongodb start | |
7.5 Run your application as it is now and verify that it fails since it is missing authentication. | |
8. in your python code add: db.authenticate('pawel','test') | |
9. sudo service apache2 restart | |
10. SHOULD BE DONE! | |
Note: In order to add another user and you forgot admin password undo line 5, add user, and repeat these steps. | |
Useful references: | |
http://stackoverflow.com/questions/4881208/how-to-put-username-password-in-mongodb | |
http://docs.mongodb.org/manual/tutorial/enable-authentication-without-bypass/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment