Showing posts with label MongoDB. Show all posts
Showing posts with label MongoDB. Show all posts

Thursday, September 7, 2017

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 127.0.0.1 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
bind_ip=12.0.0.1

        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 0.0.0.0:27017 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 0.0.0.0:27017 instead of that you will see 127.0.0.1:27017

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


Cheers...!!!Enjoy...!!!

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

Thursday, August 11, 2016

Step by Step Installation of MongoDB and How to confirm that its Running or not

Step by Step Installation of MongoDB On Windows server r2


1) Download the MongoDB from its official site according to your Platform. You can download it from Download MongoDB .

2) Now you have the Downloaded .msi file of MongoDB so open that file.

3) Click on Next.
Visionfortech,Pratik Soni Blog,latest Technological Blog

4) Check the Licence Agreement and the Click on Next.

Visionfortech,Pratik Soni Blog,latest Technological Blog

5) Click on Either Complete or Custom Verision whatever you want to install.


Visionfortech,Pratik Soni Blog,latest Technological Blog

6) Click on Install and then it will start installing mongoDB in your system.

7) Then Click on Finish.


Now You have installed .msi file on your system check that mongodb is install or not by confirming that mongoDB Folder exists into “C:\Program Files” or not.
8) Now Run Command Prompt as Administrator.

9) Then create the Directory "data" using "md data" Command.

10) Then go to data directory using “cd data” command.

11) Then create another Directory into data which is "db" using "md db" Command.

12) Now you need to tell system that MongoDB directory exists at this path So for that you need to   do the Changes into Environment Variables.

13) You can go there Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables -> Into System Variables.

14) Create New Variable called MONGO_HOME and in that put path till bin Directory of MongoDB


15) Then Click on OK then Edit Path Variable of the System Variables using %MONGO_HOME%\bin.


16) Then Click on OK.

17)  Then You need to start the server MONGOD before using mongo shell.
18) So for that You need to open another Command Prompt as Administrator.
19) Then write mongod the hit ENTER.


20) Above image shows that your mongoDB server is up and running of 27017 port No.

21) Then again open another Command Prompt as administrator and then go to the bin directory of            MongoDB using CD Command Cd C:\Program Files\MongoDB\Server\3.2\bin and then write        mongo and then hit enter.


So now you have mongoDB is install on your system.
Enjoy...!!!
Need Help Comment your Concern Below and I will try to resolve that as soon as possible.
Protected by Copyscape