3

I have a MongoDB database on my Linux server. I want to access it from another server. I tried to make a connection from my local computer with the Robomongo. The connection is succesfull, but the authentication fails.

How can I get the authentication credentials? Or should I change something in MongoDB before I can acces the database from another server / pc?

Someone else have set up this database, and there is no possibility to ask him this questions.

JohnnyHK
  • 305,182
  • 66
  • 621
  • 471
Marten
  • 1,376
  • 5
  • 28
  • 49
  • Have you tried to set the Username/Password in the "Authentication" tab of the Connection Setting screen ? - See authentication here http://scotch.io/quick-tips/mongodb/connecting-to-mongodb-using-robomongo – Tug Grall Aug 29 '14 at 13:13
  • Are you saying the server has auth enabled and set up and you don't have the credentials and can't get them? In that case, you're stuck. You have to go to the original server, shut off the process, restart it without --auth, and then redo the authentication setup. You'll have to look through the system.users table in each database to tell what you need to set up again, then get rid of those tables and redo it all with new passwords that you know. This will break every application that's using the server as they will need to be given the new creds. – wdberkeley Aug 29 '14 at 19:21
  • can you try: ./mongo --host [hostip] --port [port] --username [username] --password [pwd] to detect if you can connect to mongo with mongo shell? – Mark_H Aug 30 '14 at 09:52

5 Answers5

3

I have found the solution by my self:

The File etc/mongod.conf has a line 'bind_ip'. In this line, you originally have to add the IP address which you want to access your database. But, it don't work! You should better comment this line.

But, you don't have any authentication now, so you have to add authentication. Here you have an tutorial about this: http://ghosttx.com/2012/03/how-to-connect-to-a-remote-mongodb-server-with-mongohub-for-mac/

When you have done that, you have to enable authentication. You can do this by editing etc/mongod.conf again, and uncomment the line 'Auth = true'.

Now you can connect with you Mongo Database ;)

Marten
  • 1,376
  • 5
  • 28
  • 49
2

Ive sorted it by adding ssh option to RoboMongo following this link:

http://www.mongovue.com/2011/08/04/mongovue-connection-to-remote-server-over-ssh/

Im on OSX and connecting to Ubuntu 14 / Mongo 2.6.7 on VPS and when Ive added my ssh details to the Robomongo all seem to work ok (Ive also changed the mongo config to remove the ip_bing and enabled port 27017)

digitalM
  • 31
  • 1
  • 3
2

If you do not like to bother with authentication and stuff just make an SSH Tunnel:

ssh -fN -l username -i .ssh/id_rsa -L 9999:localhost:27017 remote.com

Just connect to mongodb on localhost:9999 and it will establish a connection to your mongodb on port 27017 on your server at remote.com.

zevero
  • 2,312
  • 21
  • 12
1

Run your mongodb with following command to access mongodb from other servers

mongod --port 10945 --bind_ip 0.0.0.0
bhaRATh
  • 716
  • 4
  • 23
0

I was not able to use Robomongo with MongoDB 3.0 too (connecting from a Windows machine to a Linux one, using SSH). The only tool that works for me is MongoChef (http://3t.io/mongochef/).

Fernando Ghisi
  • 419
  • 4
  • 8