Sunday, March 03, 2013

Mongodb - Enable Authentication

Basically it is very easy to do,
  • 1. open mongodb shell
  • 2. open admin db and add admin user (you need to have 1 user otherwise you can' lose access to your databases at all)
  • use admin
    db.addUser("admin","12345")
    
  • 3. Enable authentication auth=true (simply un-comment it) in config file 'sudo vi /etc/mongodb.conf', save changes and restart mongodb service
  • sudo service mongodb restart
    
For more information please read Security Practices and Management

No comments :