I run mongod.exe
in server with this option in cmd.exe
:
mongod.exe --dbpath=path --auth
And now, how can I do this in a config file?
my mongod.cfg
:
dbpath=D:\Program Files\MongoDB 2.6 Standard\data security= authorization= enabled
I get this error :
Error parsing INI config file: unknown option security.
MongoDB: db.grantRolesToUser() method is used to grants an additional role and its privileges to a user. The name of the user to whom to grant roles. An array of additional roles to grant to the user. The level of write concern for the modification.
Authentication is the process of verifying the identity of a client. When access control (authorization) is enabled, MongoDB requires all clients to authenticate themselves in order to determine their access.
To restrict MongoDB access by enabling authentication In the mongoconfiguration, set auth = true and restart the mongo service.
auth = true
https://docs.mongodb.com/v2.4/reference/configuration-options/#auth
security: authorization: enabled
https://docs.mongodb.com/v3.2/reference/configuration-options/#security.authorization https://docs.mongodb.com/v3.0/reference/configuration-options/#security.authorization https://docs.mongodb.com/v2.6/reference/configuration-options/#security.authorization
mongodb version 3.2
this is the correct config
security: authorization: "enabled"
with quotes since the value is a string as per the documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With