Tag Archives: not authorized on admin to execute command version 3.2.18

mongodb not authorized on admin to execute command [version 3.2.18]

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

Mongodb version 3.2.18 test questions:

Analysis:

Judging from the content of the error report, the authority is not enough, but I don’t know why, because the super user authority already used:

{
    "_id" : "admin.myUserAdmin",
    "user" : "root",
    "db" : "admin",
    "roles" : [
        {
            "role" : "userAdminAnyDatabase",
            "db" : "admin"
        },
        {
            "role" : "dbOwner",
            "db" : "admin"
        }
    ]
}

After the solution to the query error, it is found that the cluster management authority is insufficient. After adding the corresponding authority, the problem can be solved. The change of user authority is as follows:

db.updateUser(
 "root",
        {
            roles : 
            [
                  {"role" : "userAdminAnyDatabase","db" : "admin"},
                  {"role" : "dbOwner","db" : "admin"},
                  {"role" : "clusterAdmin", "db": "admin"}
             ]
        }
)                        

Successfully shut down the database system:

db.shutdownServer({shutdown: 1, force: true})

http://blog.csdn.net/warrior_zhang/article/details/50503407

See also 38142142;
User: https://docs.mongodb.org/v3.0/reference/method/db.updateUser/
mongodb backup location: http://www.linuser.com/thread-507-1-1.html
mongodb user roles:https http://docs.mongodb.org/v3.0/reference/built-in-roles/
reward detection: http://stackoverflow.com/questions/13303685/stop-unknown-instance-mongodb-ubuntu