Mongodump error Unauthorized

Hello

I have create user with backup privilege :

db.createUser({user:“translatorBckp”,pwd:“mypassword”, roles:[{ role: “backup”, db:“admin”}]})

When I execute this command I have an error :

mongodump -u ‘translatorBckp’ -p ‘mypassword’ --out=‘C:\Temp\test_backup’

Error :

If I change role for translatorBckp to root, the backup is executing correctly.

However, in documentation, backup role provides minimal privileges needed for backing up data.

Thanks

Did you try with authentication database parameter?

Yes I try with

–authenticationDatabase admin

and it’s same error.

In user roles, I have just backup. Is there something missing ?

image

May be some version related issue
What is your mongodb and mongodump version?

Mongodump’s version is 100.6.0 and mongodb is 6.0.1

Just ran into this issue, too. After updating our dev replica set from v5 to v6 and with Feature Compatibility Version set to “5.0” the existing mongodump cron job ran fine. After switching to Feature Compatibility Version set to “6.0”, the cron job failed and reported this error. It was using an account that just had the backup default role.

After creating a custom role with the privilege “{ resource: { db: “config”, collection: “system.preimages” }, actions: [ “find” ] }” and adding the new role to the account used for backups, the cron job ran successfully.

2 Likes

Hello i am using mongo atlas 6.0.1 and getting same error can you please help me i tried creating the role you mentioned but it didnt allow me to do so can you please help me

I had same problém here. My solution is upgrade package mongodb-database-tools (mongodump) from version 100.5.2 to 100.7.0

1 Like

After upgrade mongodump version, I could dump successfully. Thank you!