Cannot execute rs.conf()

Hi

I connected to my cluster using user with admin permissions but I cannot execute command rs.conf() it says that I do not have permissions. Any ideas how to solve it?

Atlas atlas-mritki-shard-0 [primary] test> rs.conf()
MongoServerError: (Unauthorized) not authorized on admin to execute command { replSetGetConfig: 1, lsid: { id: {4 [102 125 162 55 151 177 77 41 181 229 3 77 181 91 186 70]} }, $clusterTime: { clusterTime: {1628593880 98}, signature: { hash: {0 [187 107 57 244 116 85 142 114 186 151 30 29 175 187 72 4 215 129 117 185]}, keyId: 6961452270902837248.000000 } }, $db: "admin" }
Atlas atlas-mritki-shard-0 [primary] test>

-Jacek

It’s been a long while since M103 but you do not have this level of access in Atlas. If I recall correctly you should be using your own mongod instances. In my time these were vagrant images.

1 Like

Hi @Jacek_Kowalski,

I think you need to authenticate yourself with the userAdminAnyDatabase role.

By following the below command you can do that

> use admin
> db.createUser(
  {
    user: "myUserAdmin",
    pwd: "abc123",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
  }
)

Hope it helps!

Please feel free to reach out if you have any further questions or doubts.!

Thanks,
Kushagra