Over a million developers have joined DZone.

Providing Mongodb User Granular Access to User Cluster

DZone's Guide to

Providing Mongodb User Granular Access to User Cluster

When a MongoDB installation becomes a sharded install, it may be difficult. Check out how to provide inprog permissions, which makes for a secure environment.

· Performance Zone
Free Resource

Discover 50 of the latest mobile performance statistics with the Ultimate Guide to Digital Experience Monitoring, brought to you in partnership with Catchpoint.

Unlike a single instance MongoDB setup or even a ReplicaSet one, when it gets to a sharded installation, things may get tougher.

For example, if you gave a user a reading permissions to use MongoChef (a most recommended MongoDB client), when it comes to a clustered installation, in order to avoid the "not authorized to run inprog" error when running db.currentOp(), you should provide the user with some more permissions (in this case the inprog permissions).

Actually, it is pretty simple, but it is also a good example for a secured environment management:

Providing inprog Permissions

1. Get to the admin database
use admin; 
2. Authorize as a permitted user
3. Create a new role that will have permissions to manage the processes
role: "manageOpRole", 
privileges: [ 
resource: { cluster: true }, 
actions: [ "killop", "inprog" ] 
resource: { db: "", collection: "" }, 
actions: [ "killCursors" ] 
roles: [] 
4. Provide the permissions to the user:
      { role: "manageOpRole", db: "admin" }
5. Authenticate as the reading user
6. Verify things actually work! (or doing the definition of done);
Bottom Line: Simple, tested and secured like we always love our environments!

Keep Performing,
Moshe Kaplan

Is your APM strategy broken? This ebook explores the latest in Gartner research to help you learn how to close the end-user experience gap in APM, brought to you in partnership with Catchpoint.

performance ,database ,mongodb

Published at DZone with permission of Moshe Kaplan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}