3

Normally the answer to question is to set:

bindIp: 127.0.0.1

I have this set in /etc/mongod.conf. Unfortunately I am still allowed access to this database remotely. I have restarted the Mongo service a couple times, to no avail.

Does anyone have an idea as to why my database is still accessible remotely?

I'm using MongoDB version 3.0.9

awimley
  • 692
  • 1
  • 9
  • 29

4 Answers4

1

Remoting in to mongod clients using bindIp = 127.0.0.1 is possible through an SSH tunnel because the shell session is seen as 127.0.0.1.

awimley
  • 692
  • 1
  • 9
  • 29
0

Enabling bind_ip = 127.0.0.1 should be sufficient. Restart MongoDB server after the changes are done.

References:

http://greenwireit.com/it-tech-support-articles/enable-remote-access-default-mongodb-installation/

https://www.mkyong.com/mongodb/mongodb-allow-remote-access/

http://wptrafficanalyzer.in/blog/enabling-and-disabling-remote-access-to-a-mongodb-server/

Clement Amarnath
  • 5,301
  • 1
  • 21
  • 34
  • For reference, this is the version I'm using: https://docs.mongodb.com/v3.0/reference/configuration-options/ – awimley Jan 06 '17 at 16:32
0

Perhaps you must specify the mongodb.conf file when loading your mongod instance. Like so:

mongod --fork --config /etc/mongodb.conf --logpath mongodblogs/mongodb.log --dbpath mongod

staminna
  • 468
  • 1
  • 5
  • 26
0

This is best variant in security aspect:


 su <NOTROOTUSER>
 mongod --dbpath data --bind_ip localhost

Create new user on you server then log in. Root is not recommended for running mongo server.

Nikola Lukic
  • 4,001
  • 6
  • 44
  • 75