8
What basically needs to be done is
Enable Authentication
Open mongoDB shell
use admin
db.addUser("admin","adminpassword")
( IMPORTANT: you will need an admin user before you enable authentication, or else you will loose access to data ).
Now edit the mongodb config file
sudo vi /etc/mongodb.conf
and uncomment auth=true. Save it and restart mongo db sudo service mongodb restart
Bind mongoDB to trusted network or machine
Edit mongoDB config file and add bind_ip = 127.0.0.1 or a comma separated list of IPs that will be able to connect to mongoDB. Then restart.
For more information you can find a guide to do these on my website here