Not able to add Auth to Mongo 4.0.9

Hi Team,

How to enable auth for mongo 4.0.9 version, i have added below variables in /etc/mongod.conf file but still its not asking for password, please suggest

Can you share what you added, it is missing?

Are you sure it is not working? There is nothing preventing an unauthenticated connection to mongodb. Authentication is required to perform operations.

You would only be prompted for a password if you don’t provide one when you connect with a username defined via flag. e.g.

mongosh 'mongodb://localhost' -u myUsername
Enter password: ********************

If you connect without specifying a username you can authenticate using the db.auth() function.

test> use admin
switched to db admin
admin> db.auth('myUsername','IreadYourEmail')
{ ok: 1 }
admin> 
test> db.getSiblingDB('admin').auth('root','solarwinds1234')
{ ok: 1 }
test>

This topic was automatically closed after 180 days. New replies are no longer allowed.