-
Start MongoDB without access control.
$ systemctl start mongod
-
Connect to the instance.
$ mongo
-
Create the user administrator.
use admin db.createUser( { user: "admin", pwd: "password", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } )
Disconnect the mongo shell.
-
Open Mongodb with auth support .
Edit /etc/mongod.conf
security: authorization: "enabled"
Restart Mongodb
$ systemctl restart mongod
-
Create additional users as needed for your deployment.
$ mongo -u admin -p password --authenticationDatabase admin use test db.createUser( { user: "myTester", pwd: "password", roles: [ { role: "readWrite", db: "test" } ] } )
Last active
August 22, 2017 02:51
-
-
Save ywwwtseng/bce54c3eec965ad51e5ee9b44137c83a to your computer and use it in GitHub Desktop.
Mongodb Security
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment