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:
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!
If you have created a user and are having trouble authenticating, try the following: Check that you are using the correct username and password for your database user, and that you are connecting to the correct database deployment. Check that you are specifying the correct authSource database in your connection string.
This error often occurs when: You provide no hostname or an invalid hostname to the Compass connect dialog. The destination server rejects a connection on an incorrect port. Your MongoDB cluster or server has been shutdown or the server hostname has changed.
You need to configure mongod with its binding so clients can connect remotely.
bind_ip = 0.0.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With