Grant the highest role in MongoDB SCRAM possible

35 Views Asked by At

I use mongodb and I want to grant the highest role possible to user, I use default authentification system (scram).

I created user "root" and gave him clusterAdmin role:

admin> db.getUsers()
{
    users: [
        {
            _id: 'admin.root',
            userId: new UUID("f5e6b034-bdb1-4612-a53e-c2e6e46f1d49"),
            user: 'root',
            db: 'admin',
            roles: [ { role: 'clusterAdmin', db: 'admin' } ],
            mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
        }
    ],
    ok: 1
}

but when I tried to create new database I recieved error: not authorized on bot to execute command { create: "users", lsid: { id: UUID("30a32faa-208e-4993-b0df-11f2e35a15f4") }, $db: "bot" }

What can I do to achieve my goal?

0

There are 0 best solutions below