Permission Problems and Log running queries.

952 views
Skip to first unread message

Clare Chawke

unread,
Apr 28, 2014, 5:56:18 AM4/28/14
to mongod...@googlegroups.com
I ham using Mongo 2.4.9 and am having problems with user permissions and authorization.

I have created an admin database and an admin user with the following permissions:

{
        "user" : "admin",
        "pwd" : "90b114dd1744b337cd2f1e665cfd6c99",
        "roles" : [
                "userAdminAnyDatabase",
                "dbAdminAnyDatabase",
                "readWriteAnyDatabase",
                "clusterAdmin"
        ],

I connect to the DB using:
 ./mongo localhost:27000/admin -u admin -p passw0rd --authenticationDatabase admin

but if I try to get Info about another user on the db, I get a "errmsg" : "no such cmd: usersInfo" error. Is this not available in Mongo 2.4.9?

> db.runCommand(
...   {
...     usersInfo:"manager",
...     showPrivileges:true
...   }
... )
{
        "ok" : 0,
        "errmsg" : "no such cmd: usersInfo",
        "bad cmd" : {
                "usersInfo" : "manager",
                "showPrivileges" : true
        }
}


I am trying to track down long running operations on my mongo db by running the db.currentOps() command but I'm getting "unauthorized" errors:
> db.currentOp()
{ "err" : "unauthorized" }

Can some one please tell me how I can grant permissions or view permissions that that I can running commands to see long running queries/operations and, if needed kill them,

Thanks
Clare

anil

unread,
Apr 28, 2014, 4:32:14 PM4/28/14
to mongod...@googlegroups.com
Hi Clare,

{
       
"ok" : 0,
       
"errmsg" : "no such cmd: usersInfo",


On MongoDB 2.4.9, usersInfo is not a valid command. To checks users you can use following query on a specific database:
db.system.users.find()

You'll need to check this on each database as the users can be global user setup in "admin" database or a local database specific user setup within the specific database.


I am trying to track down long running operations on my mongo db by running the db.currentOps() command but I'm getting "unauthorized" errors:
> db.currentOp()
{ "err" : "unauthorized" }

While running the currentOp() command are you logged in with the userid that you created in "admin" database or some other id? If you logged in using the id you created in "admin" database, you should be able to do db.currentOp() / db.killOp() operation.

-Anil

Clare Chawke

unread,
May 2, 2014, 11:51:04 AM5/2/14
to mongod...@googlegroups.com
Great. That worked.
Thanks
Reply all
Reply to author
Forward
0 new messages