Reputation: 129
I have set up two servers s1 and s2. s1 is the server that a web server is running on while s2 is the server that my mongodb is running on. I have set up authentication on the mongo instance for security. When I try to connect to the mongo instance on s2 from s1 i get errors when trying to authenticate.
If I use:
mongo DB --host HOST --port PORT -u USER -p PASSWORD
--authenticationDatabase DB --authenticationMechanism SCRAM-SHA-1
I get this error:
Error: 2 SASL authentication support not compiled into client library.
at src/mongo/shell/db.js:228
exception: login failed
If I use:
mongo DB --host HOST --port PORT -u USER -p PASSWORD
--authenticationDatabase DB
I get this error:
Error: 18 { ok: 0.0, errmsg: "Challenge-response authentication using
getnonce and authenticate commands is disabled.", code: 2 } at
src/mongo/shell/db.js:228
exception: login failed
If I use:
mongo DB --host HOST --port PORT
I get in but then I need to use db.auth in order to do anything and then I get this error:
Error: 18 { ok: 0.0, errmsg: "Challenge-response authentication using
getnonce and authenticate commands is disabled.", code: 2 }
I have no idea why I can't get in. Can someone help with this?
Upvotes: 10
Views: 3591
Reputation: 31
The problem is to do with wrong version of mongo client. check the version using the command
mongo --version
I have had problems while logging into mogodb on https://mlab.com/
The following fixed my problem and I am on Ubuntu xenial
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install mongodb-org
Upvotes: 3
Reputation: 10891
From this error:
Error: 2 SASL authentication support not compiled into client library.
Which also fits the other errors, I think that your client library is incompatible. Compare the versions, upgrade if needed.
Upvotes: 0
Reputation: 1
Have you tried specifying the port and the database followed by the host? Try: mongo host:port/bbdd -u XXX -p
Have you enabled TLS / SSL?
Regards
Upvotes: 0