Does enableLocalhostAuthBypass override --auth?

The documentation ( link ) says: “Specify 0 to disable localhost authentication bypass. Enabled by default” for enableLocalhostAuthBypass. But when I start mongod with -auth:

 mongod --port 30xxx --dbpath=/home/dev/xxxx --auth 

And then connect via localhost:

 mongo --host localhost --port 30xxx myDb 

And then try to do something:

 > show collections Wed Aug 7 11:07:50.420 JavaScript execution failed: error: { "$err" : "not authorized for query on configuration.system.namespaces", "code" : 16550 

Bzzt, no. I can connect to -u -p and run show collections .

From the docs, it really sounds like connecting through localhost will bypass auth by default. However, this is not what I see. Are the documents unclear? Am I reading this wrong?

+4
source share
1 answer

enableLocalhostAuthBypass used for the case when you do not have a specific user, but with auth enabled on MongoDB, and you do not want to be able to connect at all. It is not intended to completely disable authentication for the local host.

Once you have identified the user, enabledLocalhostAuthBypass do nothing, and you must authenticate first.

This is described in the documentation at: http://docs.mongodb.org/manual/tutorial/add-user-administrator/#authenticate-with-full-administrative-access-via-localhost

+11
source

Source: https://habr.com/ru/post/1495809/


All Articles