Mongodb config file option for authentication

mac-osxmongodb

I'm trying to start mongodb(3.0.2) with authentication enabled on mac osx 10.10 from the doc. Starting monodb manually with --auth works and starts without any error. I installed mongodb using homebrew and want to place the auth switch in configuration file. I could not find anything appropriate in Configuration Options. I tried auth: true in the config file but mongodb failed to start.

Anybody has got it working, I'm looking for config file option(rather than –auth) to run mongodb with authentication enabled to prevent anonymous access.

Best Answer

It is actually

authorization: enabled

in you config file it needs to be under security: and your config file should look like

net:
  bindIp: 127.0.0.1
security:
  authorization: enabled

For more information see : http://docs.mongodb.org/master/reference/configuration-options/#security.authorization