I am unable to authenticate mongodb remotely. I'm running MongoDB 3.0.0 provided by the DigitalOcean One-Click installer, and I can't seem to set up authentication properly.
I have 1 database called wbio_production. I followed mongodb docs tutorials as best as I could. When I execute:
> db.auth("siteUserAdmin","MYPASSWORD")
1
> db.getUsers()
The output of that is:
{
"_id" : "admin.siteUserAdmin",
"user" : "siteUserAdmin",
"db" : "admin",
"roles" : [
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
}
And when I switch to the wbio_production database and perform the same getUsers():
> use wbio_production
switched to db wbio_production
> db.getUsers()
[
{
"_id" : "wbio_production.herokuUser",
"user" : "herokuUser",
"db" : "wbio_production",
"roles" : [
{
"role" : "userAdmin",
"db" : "wbio_production"
},
{
"role" : "readWrite",
"db" : "wbio_production"
}
]
}
]
When I fill out the connection form in Robomongo however, it cannot successfully connect to the database. Authorization always fails, however it does successfully connect to the database.
I have tried the following combinations of using the users above:
- DB: Admin, User: siteUserAdmin
- DB: Admin, User: herokuUser
- DB: wbio_production, User: siteUserAdmin
- DB: wbio_production, User: herokuUser
All of them wind up with some output coming back in the heroku logs similar:
failed with error 13: "not authorized for query on wbio_production.mongoid_forums_forums"
I have tried reinstalling mongodb, recreating users based off different tutorials, and just trying different peoples explanations. I've spent about 5 hours now looking for a solution to my issue, and now I must turn to SO for your advice. I'm sure this is a simple error on my part that I am not understanding from the docs or something I am continuously missing in the set up.
What must I do to get a secured and functional MongoDB server? Thanks!