Cannot add authorization "enable" to mongod.conf yaml ccp-error

Hi Steve,

I did as root

ps -aef | grep 44529

root 44529 1 1 11:04 ? 00:11:43 mongod -f node2.conf
root 233055 31059 0 22:47 pts/10 00:00:00 grep 44529

ps -aef | grep 44585
root 44585 1 1 11:04 ? 00:11:44 mongod -f node3.conf
root 234045 31059 0 22:52 pts/10 00:00:00 grep 44585

ping local

name or service not known

ps -aef | grep [m]ongod
root 44529 1 1 11:04 ? 00:11:48 mongod -f node2.conf
root 44585 1 1 11:04 ? 00:11:45 mongod -f node3.conf
uli 127446 45830 0 15:58 pts/16 00:00:08 mongosh mongodb://local
root 129697 1 0 16:07 ? 00:03:46 mongod -f node1.conf
mongodb 141575 1 0 16:49 ? 00:02:10 /usr/bin/mongod --config /etc/mongod.conf
root@docker:/etc# ps -aef | grep [m]ongo
uli 34082 23014 0 10:21 pts/11 00:00:02 mongo --host 127.0.0.1:27017
root 44529 1 1 11:04 ? 00:11:48 mongod -f node2.conf
root 44585 1 1 11:04 ? 00:11:45 mongod -f node3.conf
uli 127446 45830 0 15:58 pts/16 00:00:08 mongosh mongodb://local
root 129697 1 0 16:07 ? 00:03:46 mongod -f node1.conf
uli 129945 51824 0 16:08 pts/15 00:00:01 mongo --port 27011
mongodb 141575 1 0 16:49 ? 00:02:10 /usr/bin/mongod --config /etc/mongod.conf

I hope I understood you correctly.

Regards,

Uli

Hi guys,

this mongodb.conf drives me crazy. Whatever I try I cannot create a user because of it needs authentication. If I disable authentication in the mongod.conf file with # and restart mongod it still dies not work to create the admin user because of that requiresauthentication error message. Any idea whatelse I could do to fix that?

Many thanks in advance

Uli

The main issue with your steup is that you have 4 instances of mongod running.

Since ping local gives an error there is no way to know where you connect with mongosh mongodb:/local.

You are running some mongod as root. You should not run any server as root.

Sine it looks like you are trying to do m103 exercises, I would recommend you use the IDE. The IDE strats with a fresh VM and you do not hand up with things from previous lab.

I suspect that you have already created a user by doing a prevovious lab. To ease hurdles the lab instructions assume a given setup which you might not gave on your machine. You will not be able to create a new user if one exists unless you authenticate.

You should stop all mongod running on your system and use the IDE until you are familiar enough to put back your system in working health.

from the above answers, it is clear that you are either NOT restarting the server you try to connect to, or you connect to the wrong server.

please first clean (kill) all running instances, check this post for the steps: https://www.mongodb.com/community/forums/t/m150-implementing-internal-authentication-error/171089/3?u=yilmaz_durmaz

next, disable (comment out) security in all your config files.

then, one by one, check your config files, and make notes of the ports you have used. run each config file independently of each other and see if they run. then if they start, connect to them with mongo --port 27xxx using the port number of that config file. since you run them all in the same machine, you don’t need to use --host 120.0.0.1 portion.

act cautiously because you are using 4 different ports: 27011, 27012, 27013, and 27017. omitting the port number will connect you to the wrong instance.

when done, kill the one you have tested from the terminal or execute a shutdown while in the mongo shell.

after making sure that all of your config files do work, you can then try enabling security. but obey the procedure adding the security. doing it in the wrong order will prevent your instances from starting (so you will also know where the problem is).

2 Likes

I am following the same steps as mentioned below

  1. disable authentication in your config file
  2. restart mongod
  3. add an admin user
  4. enable authentication in your config file
  5. restart mongod

But Still I am getting this error: 2023-10-19T07:37:38.546+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
[/quote]

  • instead of “restart”, try fully stop it first then start gain
  • makes sure you are connecting to the right server at the right port.