0

I am trying to create one GOD user who has access to all the dbs

The following users have been created :

db.createUser( { user: "admin", pwd: "password", roles: [ "userAdminAnyDatabase" ]    })
db.createUser( { user: "root", pwd: "password", roles: [ "root" ]    })
db.createUser( { user: "mongo", pwd: "password", roles: [  "readWriteAnyDatabase","dbAdminAnyDatabase","clusterAdmin" ]})

I am trying to connect through the following connection URL

mongodb://mongo:password@<mongodb IP>/development_admin

I tried with all the users created but none seemed to work. I always get the following error :

   MongoError: auth failed

Is there anything that I am performing wrong here ?

codejammer
  • 469
  • 1
  • 7
  • 18
  • Can you show the code that is doing the connection and authentication? Can you connect through the mongo shell ok? `$ mongo -u admin -p password --host mymongohost:mymongoport/mymongodatabase` – wdberkeley Aug 15 '14 at 19:13
  • Yes, I could connect using mongoshell – codejammer Aug 17 '14 at 06:45
  • [Authentication is managed at a database level](http://stackoverflow.com/questions/18216712/cannot-authenticate-into-mongo-auth-fails) – laggingreflex Apr 13 '15 at 02:30
  • 1
    @laggingreflex: not necessarily. Basically, you can use every database to store the auth info – though you have to change explicitly state [`authenticationDatabase`](http://docs.mongodb.org/manual/reference/program/mongo/#cmdoption--authenticationDatabase) then. – Markus W Mahlberg Apr 14 '15 at 20:57

0 Answers0