Issues to connecting the auth user

I am pasting this down to the terminal mongo admin --host localhost:27000 --eval ’
db.createUser({
user: “m103-admin”,
pwd: “m103-pass”,
roles: [
{role: “root”, db: “admin”}
]
})

but i am getting the following error : Client experienced a timeout when connecting to the database - check that mongod is running on the correct port, and that your user was created with the correct settings.

Is mongod running on the correct port?
What is the correct port?
What was the returned value from the createUser()?

Hi,

I am setting up the mongod --port 27000 --bind_ip 192.168.103.100,localhost --dbpath /data/db/ --auth and when I paste the mongo admin --host localhost:27000 --eval ’
db.createUser({
user: “m103-admin”,
pwd: “m103-pass”,
roles: [
{role: “root”, db: “admin”}
]
})
’ I get the following auth error: “Error: couldn’t add user: there are no users authenticated”

The above means that a user already exists. Can you authenticate with this user and password? Which lab are you doing?

Can you provide the output of

ps -aef | grep [m]ongo
ss -tlnp

the first lab which is called “lauching mongod”

I just started the mongod without the --auth flag and when I called the “validate_lab_launch_mongod” the answer code was issued.

Wow. It is funny that it works by removing –auth. The requirements were

  • run on port 27000
  • data files are stored in /data/db/
  • listens to connections from the IP address 192.168.103.100 and localhost
  • authentication is enabled
1 Like

Yeah. I’m not proud of this solution at all :joy: I will scrutinize what I am doing wrong. but anyways thanks for your help!

Não é uma boa solução :laughing:

Suggest that you do it again with the auth option and ask @steevej-1495 if you have any questions. You will definitely need authorisation enabled in future labs.

brasileiro? :joy: I will try fix this although it don’t work at all. One question, the localhost:27000 must be with the auth flag as well? If you could show me your solution It would be helpful…

Hi @Gabriel_44361,

Thanks for surfacing this. I will have it checked.

If you mean that auth is enabled by default for localhost:27000 then the answer is no.

Please click on See detailed answer button at the bottom to see the answer. It gets enabled only after you have passed/failed any lab.

Hope it helps!

~ Shubham

1 Like

Nao falo Portugues… but I have visited your country :grin:
Happy Learning!

1 Like