June 2014
Intermediate to advanced
696 pages
38h 52m
English
Once the user administrator account has been created, you need to restart the MongoDB database by using the --auth parameter, like this:
mongod –dbpath <mongo_data_location>/data/db --auth
Clients now have to use a username and password to access the database. Also, when you access MongoDB from the shell, you need to execute the following commands to authenticate to the admin database so that you can add users with rights to the databases:
use admindb.auth("useradmin", "test")
You can also authenticate to the admin database when you start the MongoDB shell by using the --username and --password options and specifying the admin database, as in this example:
Read now
Unlock full access