How to prevent remote access of mognodb in windows and linux

How to prevent remote access of mognodb in windows and linux

This post is all about how to protect your mongodb server of windows or linux from ransomeware attack or we can say mongodb server is accessible only to localhost or not any other location.

Please see the below solution.Hope you will get what you want..!!

Into Linux :

To prevent access of mongodb remotelly user need to do some changes into mongodb.conf.So to do that follow below steps.

1) Open /etc/mongodb.conf using below command
vi /etc/mongodb.conf

2) find all the statments which starts with bind_ip.Delete all the sentences.

3) Enter Below statment only into /etc/mongodb.conf

        If user want to give access to some machines or we can say some IP addresses for Application so user can do that by adding below line to /etc/mongod.conf

   bind_ip=<ip address>

Into windows :

1) First of all user need to turn of the firewall.

2) To turn on the firewall follow below steps.

*) Open command prompt using CMD

*) Run Below command and if it has then any user can access your database remotely.
netstat -a

*) Open Run using start -> Run or press windows+R Key to open Run prompt.

*) Write control into run prompt

*) It will open Control Pannel.

*) Go to Network and sharing center

*) Go to Windows firewall

*) Go to Advance setting

*) Select Inbound Rules and delete all rules related to Mongodb

                *) Again please apply below command to command prompt and you won't be able to see instead of that you will see

So now no outside user will be able to access your mongodb server.Because you have grant access of only localhost or to mongodb server only.


Feel free to comment below your experience with above approach and If you still find any problem with above steps Let me know I would love to help you to resolve your  problem.

If you want to take your Technological Knowledge to the Next Level and For More Technological information Stay tuned to Visionfortech