Posts

Showing posts with the label Mongodb

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...

How to install mongodb in ubuntu 15.04

Step 1: If you install any packages of mongodb yet, firstly remove all. To remove all existing packages execute the below command: sudo apt-get purge mongodb-org sudo apt-get autoremove Remove the old mongodb source list you created in below folder. sudo rm /etc/apt/sources.list.d/   Remove db and logs: sudo rm -r /var/lib/mongodb sudo rm -r /var/log/mongodb Step 2: Add debian repository: echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" |  sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list   Step 3: Update and install: sudo apt-get update sudo apt-get install -y mongodb-org Step 4: Start mongo db: sudo service mongod start or systemctl start mongod  Step 5: Configure MongoDB username and password: open mongo shell : (cntrl+alt+t) open termianl and type > mongo   then the shell is open. then switch the database typing> use admin then Create the r...