Discussion:
[mongodb-user] mongodb remote authentication failure Mongod v4
Mohd Sufian
2018-11-27 07:44:18 UTC
Permalink
I have recently installed mongodb on one of our windows 2016 server with
below configuration and running mongod as

enter code here

mongod --config C:\mongo_db\config\mongo_db_configuration.conf --auth

--config file
net:
# MongoDB server listening port
#bindIp: 0.0.0.0,192.168.43.250
port: 27017
bindIpAll: true
storage:
# Data store directory
dbPath: "C:\\mongo_db\\db"
mmapv1:
# Reduce data files size and journal files size
smallFiles: true
systemLog:
# Write logs to log file
destination: file
path: "C:\\mongo_db\\logs\\mongodb.log"
security:
authorization: enabled

We have created a root user in admin database

enter code hereMongoDB Enterprise > db.runCommand({connectionStatus:1}){
"authInfo" : {
"authenticatedUsers" : [
{
"user" : "root",
"db" : "admin"
}
],
"authenticatedUserRoles" : [
{
"role" : "dbAdminAnyDatabase",
"db" : "admin"
},
{
"role" : "root",
"db" : "admin"
}
]
},
"ok" : 1}

I am able to connect to the mongod instance locally (mongo --port 27017 -u
"root" -p "12345" --authenticationDatabase admin) but getting error while
connecting remotely.the server firewall is disabled.

"C:\Mongodb>mongo.exe 192.168.0.171:27017/admin -u root -p 12345MongoDB shell version v4.0.4
connecting to: mongodb://192.168.0.171:27017/adminImplicit session: session { "id" : UUID("c68e9dd5-6f7b-4356-bc3e-688a7e2b3e1d") }MongoDB server version: 4.0.42018-11-26T23:50:47.534+0800 E QUERY [js] Error: Authentication failed. :
***@src/mongo/shell/db.js:1685:20@(auth):6:1@(auth):1:2
exception: login failed"
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/540bd9e7-6882-488e-b8c3-101f70f24fa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Kevin Adistambha' via mongodb-user
2018-11-30 05:54:12 UTC
Permalink
Hi,

The error login failed implies that the username/password combination for
the authentication database (admin) is incorrect. The presence of this
error means that there should be no network issues.

Could you confirm that you’re connecting to the correct server at
192.168.0.171? I noticed that you commented out the IP address
192.168.43.250 in your config file. Do you have multiple MongoDB servers
running in your network environment?

Best regards,
Kevin
​
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/8a67e4cd-0e0f-43e4-b464-c6fa5377c3c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...