In MongoDB, the remote access is enabled by default. Remote access to MongoDB server can be controlled by the variable “bind_ip” specified in the configuration file mongodb.conf.
In MongoDB, the variable “bind_ip” is not set. So a MongoDB client, accessed from any remote machine can be connected to the MongoDB server by default.
The information provided in this article is tested with MongoDB 2.2.2 in Ubuntu 12.04 LTS.
Disabling remote access ( Localhost only access ) to MongoDB Server
- OpenĀ the file mongodb.conf and add the line bind_ip = 127.0.0.1
- Restart MongoDB service [ In Ubuntu : $sudo service mongodb restart ]
- Now remote access is disabled
Testing remote access to MongoDB Server
Installing MongoDB client in remote machine ( Ubuntu 12.04 )
$sudo apt-get install mongodb-clients
Connecting to MongoDB server from remote machine
ubuntu@node6:~$ mongo --host 192.168.1.3 MongoDB shell version: 2.0.4 connecting to: 192.168.1.3:27017/test Fri Dec 21 11:15:48 Error: couldn't connect to server 192.168.1.3:27017 shell/mongo.js:86 exception: connect failed
Note : Success, remote access is failed
Enabling remote access to MongoDB Server
- OpenĀ the file mongodb.conf and comment the line containing the variable bind_ip
- Restart MongoDB service [ In Ubuntu : $sudo service mongodb restart ]
- Now remote access is enabled
Testing remote access to MongoDB Server
Connecting to MongoDB server from remote machine
ubuntu@node6:~$ mongo --host 192.168.1.3 MongoDB shell version: 2.0.4 connecting to: 192.168.1.3:27017/test > db.version() 2.2.2
Note : Success, remote access is enabled

I am George Mathew, working as software architect and Android app developer at wptrafficanalyzer.in
You can hire me on hourly basis or on project basis for Android applications development.
For hiring me, please mail your requirements to info@wptrafficanalyzer.in.
My other blogs
store4js.blogspot.com
Hi,
Is it need to install mongo client?
in my machine i have used ubuntu 12.04. I didn’t find any bind_ip inside my etc/mongodb.conf.
is it necessary to config this file explicitly