Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to setup a replica set, but when I issue:


On the first server, I get the following error:

{ "errmsg" : "need to login", "ok" : 0 }

That is strange though, because in my configuration auth: true is commented out.

Any ideas?

share|improve this question
up vote 3 down vote accepted

You may have auth: true commented out, but did you start with --auth or --keyFile or specify keyFile in the config file? Setting the keyFile enables authentication implicitly, so that could be your issue here.

If you want to be completely sure, temporarily shut down the mongod instance and start it manually, specifying only the basics (port, replica set name etc.) explicitly. At least then you can be sure of what is and is not enabled.

For a running instance you can get the current options parsed from the top of the log file for the instance - they are printed out as part of the startup messaging. You can also get them by running: getCmdLineOpts (note though that this requires admin rights, so you may see issues if you are running with auth on and don't have an admin user defined).

share|improve this answer
That was the problem, had keyFile on. – Justin Dec 6 '12 at 21:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.