Question

Cant Secure MongoDb need help

I’m trying to secure mongodb by following the link

https://www.digitalocean.com/community/tutorials/how-to-secure-mongodb-on-ubuntu-20-04

But it isn’t working. -I’m on step 1:.

This is what happens

db.createUser(
... {
... user: "Adam",
... pwd: passwordPrompt(),
... roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
... }
... )
Enter password:
uncaught exception: Error: couldn't add user: Could not find role: readWriteAnyD atabase@test :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1367:11
@(shell):1:1


What went wrong?

Does this mean the mongodb installation is broken? I followed the digital ocean link https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-20-04


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer