1

i have added auth to my MongoDB instance. I created a user with the following command

db.createUser(
 { user: "cocodrile", pwd: "amazonas",
   roles: [
       { role: "userAdminAnyDatabase", db: "admin"},
       { role: "dbOwner", db: "admin"},         
       { role: "dbOwner", db: "brasil_database"}, 
       { role: "dbOwner", db: "usa_database"} ,
       { role: "dbOwner", db: "argentina_database"},
       { role: "dbOwner", db: "test"}] })

I want to perform a db.fsyncLock() and it says:

db.fsyncLock()
{
    "ok" : 0,
    "errmsg" : "not authorized on admin to execute command { fsync: 1.0, lock: true }",
    "code" : 13
}

What i am doing wrong? Thanks!

X.Otano
  • 2,079
  • 1
  • 22
  • 40

1 Answers1

3

You're missing the hostManager built-in role, which has permissions to monitor and manage servers and perform some cluster-as-a-whole actions like fsync.

wdberkeley
  • 11,531
  • 1
  • 28
  • 23