Hi all,
I have a question concerning installing mongodb on my MacBook (M1) with security enabled.
In chapter 1, the instructor says that when entering the mongo shell for the first time, one can make use of the localhost exception. This exception makes sure one does not have to provide any credentials at all when singing in for the first time. But as soon as one is logged into the system, one has create an user on the admin database with the root role:
admin> db.createUser(
... {
..... user : "admin",
..... pwd : "admin",
..... roles : ["root"]
..... }
... );
{ ok: 1 }
Although this works perfectly fine, I expected to not being able to authenticate without providing any credentials when trying to access mongodb. Instead, mongosh allows me to authenticate without any credentials.
Is there anything wrong with my configuration or is this expected behaviour?
# Docs available on
# https://www.mongodb.com/docs/manual/reference/configuration-options/#configuration-file
systemLog:
path: mongo_university/m103/chapter1/log/mongo.log
destination: file
processManagement:
fork: true
pidFilePath: mongo_university/m103/chapter1/pid
net:
bindIp: 127.0.0.1
port: 27017
security:
# when you start your instance, you have to create a database admin user. As soon as the user is created,
# the localhost exception will close and you have to authenticate with the database administrator
authorization: enabled
storage:
dbPath: mongo_university/m103/chapter1/data/db
Thank you in advance!
Marco