How disable anonymous access to MongoDB OR Enable Client Access Control in MongoDB.
Securing MongoDB with Authentication and Authorization: Step 1) Login using shell and Create an admin account: Open terminal and login using below command> mongo Switch to admin db using below command> use admin; Create Admin user using below command> db.createUser({ user : "admin", pwd : "pass", roles: [ { role: 'root', db: 'admin' } ] }); Now Give grand Roles to Admin User using below command: db.grantRolesToUser( " admin ", [{ "role" : "readWriteAnyDatabase", "db" : "admin" },{ role: "userAdminAnyDatabase", db: "admin" }] ) Step 2) Test your admin account using below command> mongo -u admin -p pass --authenticationDatabase admin Step 4) Force authorization FOR MONGODB 3.0 AND ABOVE add these lines in /etc/mongod.conf> security: authorization: enabled FOR MONGO...