[FAIL] "The server requires authentication"

Hi Team,

Launch a mongod instance in the IDE terminal with a configuration file:

1. Write the configuration file. There should be an empty configuration file in your IDE File Editor, where you can specify options in YAML.As a reminder, here are the requirements of your mongod instance:
** * run on port 27000**
** * authentication is enabled**

when i am doing lab test , im getting the following error.I have given mongod --port 27000 --auth in mongod.conf file.Am i missing something here in understanding the IDE terminal or the process to follow .Please help

3 total, 0 passed, 0 skipped:
[FAIL] “The server is running on localhost:27000”

Did you launch mongod on port 27000?

[FAIL] “The server requires authentication”

Don’t forget to launch mongod with authentication enabled!
You can do this using the configuration file.

[FAIL] “Mongod was started with a configuration file”

Did you launch mongod using a configuration file?

Regards,
RK

This question is related to MongoDB University course M103.

It is preferable to ask MongoDB University related question to the university specific forum.

Please post a screenshot of the issue. Most likely you did like few others and entered the mongod command in the file editor part of the IDE. Please revise the IDE presentation lesson to understand the different part of the IDE.

Hi Could you please provide me the link for university specific forum
Thank you

RK

https://www.mongodb.com/community/forums/c/M103

1 Like

That is not the correct syntax of mongod.conf file.
You must provide options in YAML format, eg.

net:
 port : 27000
security:
 authorization : enabled

You can refer to https://docs.mongodb.com/manual/reference/configuration-options/

2 Likes

And YAML is very sensible to indentation. That is why that you should enclosed your YAML, code, or JSON document between 2 lines of triple back ticks (```) to ensure that the formatting is preserved such as:

net:
    port : 27000
security:
    authorization : enabled
1 Like

Thanks, i didn’t know how to indent.
Bye

What is the solution of this error.

Have you started mongod with authorization enabled?

The solution for this error is

Modify mongod.conf file under /etc

make sure the port is 27000

net:
 port : 27000
security:
 authorization : enabled

whenever you are enabling the authorization , before that make sure to create a username with password under admin db ot your application db, so that you would be able to login after enabling the authorization.

Regards,
RK

1 Like

2 posts were split to a new topic: The server requires authentication

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