Are there global DB Admin accounts in MongoDB?

50 views
Skip to first unread message

MongoNovice

unread,
Aug 10, 2015, 6:04:43 PM8/10/15
to mongodb-user
SysAdmin has left, but I have access to MMS (https://cloud.mongodb.com)  to create an account.

I thought I was creating an Admin account.


I can goto Deployment->Authenticated users  (click new user) 



On linux 

LocalServer>    ./mongo SomeIPAddress:27000/admin  -u DBAsupport -p Mypassword


haven't figured how to connect on a windows machine properly syntax is slightly different.
 


When I do this I can I'm connected to 


connecting to: SomeIPAddress:27000/admin

> show dbs;

admin  0.08GB

local  0.08GB




I do not see my "TEST" database?
 SomeIPAddress:27000/Test


I was hoping there would be a global admin account I could manage and see all dbs? 
I dont quite understand the model?

On MySQL and MS SQL there are Admin accounts that allow use to see all DBs? 

is there a link to explain this?






Ankit Kakkar

unread,
Aug 12, 2015, 2:53:26 AM8/12/15
to mongodb-user
Hello,

Please note that "test" is the default database that mongo shell connects to when you don't specify any database while connecting. But this database will only show up in the list of databases when you actually insert a document into it. Consider following mongo shell snippets:

// Connecting mongo shell for the first time
ankit
:27017(mongod-3.0.5) test> show dbs
local 0.078GB // Note "test" is not shown although I was connected to "test"
// Inserted an empty document


ankit
:27017(mongod-3.0.5) test> db.coll.insert({})


Inserted 1 record(s) in 145ms


WriteResult(
{ "nInserted": 1 }
)


ankit
:27017(mongod-3.0.5) test> show dbs
local 0.078GB
test
0.078GB // Now, notice that test is showing up in this list


Note that the user that you used to connect to mongo database has a role "userAdminAnyDatabase" that gives it user administration privileges for all the databases in the cluster. One of such privileges is "listDatabases" and because of this privilege you are able to view all the databases in the system. Also, it is worth noting that "UserAdmin" role allows that account to create users, but general database read/write permisionss would still need to be explicitly granted (i.e. "readWriteAnyDatabase").

Please read through following link to learn more about this specific role:

The "Global admin" that you are looking for is a user with root privilege in the admin database: http://docs.mongodb.org/manual/tutorial/add-admin-user/.

It is also possible to give finer grained access to users using custom roles. 

For more details, please go through: http://docs.mongodb.org/manual/administration/security-user-role-management/ and let me know if you have any further queries.

Regards,
Ankit
Reply all
Reply to author
Forward
0 new messages