Rename replica set: not authorized on local to execute command delete

Hi all,
I’m following the procdure ( https://www.mongodb.com/docs/v4.4/tutorial/rename-unsharded-replica-set/ ) to rename a three node Mongodb replicaset ver 4.4 .
After inserting the new document in local db, system.replset cllection, I got an error in delete the old document.
The error is that I don’t have permissions on the local db.

db.getSiblingDB("local").system.replset.deleteOne({_id: oldId})
uncaught exception: WriteCommandError({
        "ok" : 0,
        "errmsg" : "not authorized on local to execute command { delete: \"system.replset\", ordered: true, lsid: { id: UUID(\"37921152-f609-4493-891f-f7bd0b3dff72\") }, $db: \"local\" }",
        "code" : 13,
        "codeName" : "Unauthorized"
}) :
WriteCommandError({
        "ok" : 0,
        "errmsg" : "not authorized on local to execute command { delete: \"system.replset\", ordered: true, lsid: { id: UUID(\"37921152-f609-4493-891f-f7bd0b3dff72\") }, $db: \"local\" }",
        "code" : 13,
        "codeName" : "Unauthorized"
})
WriteCommandError@src/mongo/shell/bulk_api.js:417:48
executeBatch@src/mongo/shell/bulk_api.js:915:23
Bulk/this.execute@src/mongo/shell/bulk_api.js:1163:21
DBCollection.prototype.deleteOne@src/mongo/shell/crud_api.js:375:17

Has anyone fixed the issue?
Thanks for any help you can give me.
King regards
Giorgio Prandi

What privileges your user has?
I think access to system objects is removed from Inbuilt roles
You have to create a custom role giving explicit privs/actions on that collection or create a temporary user and grant __system internal role to this user

2 Likes

Hi Ramachandra,
thanks a lot for your suggestion, it was very helpful and i was able to rename the replica set.
King regards
GP