How to enable authentication/authorization to Mongos router?

Hi all,

I have two nodes -

  1. Node 1 - 1 mongos, 1 config server and 1 Replica set
  2. Node 2 - only 1 Replica set

This whole setup is going good. but I have a major concern of enabling authentication to mongos server. at present I’m able to login to mongos without any authentication credentials and that is worrying me. and now I’m unable to find a proper resource on how to prevent this from happening. as mongos config does not have any security.authorization key to it how do I enable authorization to it?

After hours of looking up on the internet I found that I have included a property called

transitionToAuth: true

Due to this it does not waits for adhoc authentication rather authenticates based on the keyFile itself. this is why I was able to see all the databases in my shards directly.

New learning! Phew!


Hi @Vibhanshu_Biswas - I see this question is marked as [Solved], but I can’t see a solution here to your post. Does this mean you solved it yourself and you’re no longer looking for an answer to your question?


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.