MongoDB用户及权限管理之角色说明的示例分析

技术MongoDB用户及权限管理之角色说明的示例分析这篇文章给大家分享的是有关MongoDB用户及权限管理之角色说明的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。mongodb安装完

本文将与您分享关于MongoDB用户的角色描述和权限管理的示例分析的内容。我觉得边肖很实用,就和大家分享一下作为参考。让我们跟着边肖看一看。

安装GodB后,默认不开启auth模块,普通用户和超级管理员无需认证即可操作。当然裸奔是有风险的。为了安全起见,请打开身份验证模块。

首先,你需要知道以下几点:

1.mongodb没有默认的管理员帐户,所以需要先添加一个管理员帐户,然后打开权限验证。

2.切换到管理数据库,添加的帐户就是管理员帐户。

3.用户只能登录到用户的数据库,包括管理员帐户。

4.管理员可以管理所有数据库,但不能直接管理其他数据库。他们只能在管理数据库验证后才能这样做。这很奇怪。

1.用户权限角色的描述

1.1数据库用户角色

read

允许用户读取指定的数据库。

提供读取所有非系统集合和下列系统集合的数据的能力。

拥有以下权限:

聚合、检查切片索引、克隆选择映射、统计

计数、dataSize、dbHash、dbStats、distinct、filemd5

地理近距、地理搜索、地理行走、群组

mapReduce(仅内联输出。),文本(测试版功能。)

readWrite

允许用户读写指定的数据库

提供readrole的所有权限以及修改所有非系统集合和system.js集合上的数据的能力。

除了读取权限,它还具有以下权限:

克隆选择(作为目标数据库。),convertToCapped

创建(并隐式创建集合。)

drop()、dropIndexes、emptycapped、ensureIndex()

findAndModify,mapReduce(输出到集合。)

renameCollection(在同一个数据库中。)

读和读写只是对库中表的操作权限。

1.2数据库管理角色

数据库管理

允许用户在指定的数据库中执行管理功能,如创建、删除索引、查看统计信息或访问system.profile

提供执行管理任务的能力,例如与架构相关的任务、索引、收集统计信息。此角色不授予用户和角色管理权限。

拥有以下权限:

干净、简洁、紧凑、转换定位

create,db.createCollection(),dbStats,drop(),dropIndexes,ens

ureIndex()

indexStats,profile,reIndex,renameCollection  (within a single database.),validate

  • dbOwner

Provides the ability to perform anyadministrative action on the database. This role combines the privilegesgranted by the readWrite, dbAdmin and userAdmin roles.

  • userAdmin

允许用户向system.users集合写入,可以找指定数据库里创建、删除和管理用户

Provides the ability to create and modifyroles and users on the current database. Since the userAdmin role allows usersto grant any privilege to any user, including themselves, the role alsoindirectly provides superuser access to either the database or, if scoped tothe admin database, the cluster.

1.3 Cluster Administration Roles

  • clusterAdmin

只在admin数据库中可用,赋予用户所有分片和复制集相关函数的管理权限。

Provides the greatest cluster-managementaccess. This role combines the privileges granted by the clusterManager,clusterMonitor, and hostManager roles. Additionally, the role provides thedropDatabase action.

拥有如下权限:

addShard,closeAllDatabases,connPoolStats,connPoolSync,_cpuProfilerStart

_cpuProfilerStop,cursorInfo,diagLogging,dropDatabase

enableSharding,flushRouterConfig,fsync,db.fsyncUnlock()

getCmdLineOpts,getLog,getParameter,getShardMap,getShardVersion

hostInfo,db.currentOp(),db.killOp(),listDatabases,listShards

logRotate,moveChunk,movePrimary,netstat,removeShard,unsetSharding

repairDatabase,replSetFreeze,replSetGetStatus,replSetInitiate

replSetMaintenance,replSetReconfig,replSetStepDown,replSetSyncFrom

resync,serverStatus,setParameter,setShardVersion,shardCollection

shardingState,shutdown,splitChunk,splitVector,split,top,touch

  • clusterManager

Provides management and monitoring actionson the cluster. A user with this role can access the config and localdatabases, which are used in sharding and replication, respectively.

  • clusterMonitor

Provides read-only access to monitoringtools, such as the MongoDB Cloud Manager and Ops Manager monitoring agent.

  • hostManager

Provides the ability to monitor and manageservers.

1.4 Backup and Restoration Roles

  • backup

Provides privileges needed to back up data.This role provides sufficient privileges to use the MongoDB Cloud Managerbackup agent, Ops Manager backup agent, or to use mongodump.

  • restore

Provides privileges needed to restore datawith mongorestore without the –oplogReplay option or without system.profilecollection data.

1.5 All-Database Roles

  • readAnyDatabase

只在admin数据库中可用,赋予用户所有数据库的读权限

Provides the same read-only permissions asread, except it applies to all but the local and config databases in thecluster. The role also provides the listDatabases action on the cluster as awhole.

  • readWriteAnyDatabase

只在admin数据库中可用,赋予用户所有数据库的读写权限

Provides the same read and writepermissions as readWrite, except it applies to all but the local and configdatabases in the cluster. The role also provides the listDatabases action onthe cluster as a whole.

  • userAdminAnyDatabase

只在admin数据库中可用,赋予用户所有数据库的userAdmin权限

Provides the same access to useradministration operations as userAdmin, except it applies to all but the localand config databases in the cluster.

Since the userAdminAnyDatabase role allowsusers to grant any privilege to any user, including themselves, the role alsoindirectly provides superuser access.

  • dbAdminAnyDatabase

只在admin数据库中可用,赋予用户所有数据库的dbAdmin权限。

Provides the same access to databaseadministration operations as dbAdmin, except it applies to all but the localand config databases in the cluster. The role also provides the listDatabasesaction on the cluster as a whole.

1.6 Superuser Roles

  • root

只在admin数据库中可用。超级账号,超级权限

Provides access to the operations and allthe resources of the readWriteAnyDatabase, dbAdminAnyDatabase,userAdminAnyDatabase, clusterAdmin, restore, and backup combined.

感谢各位的阅读!关于“MongoDB用户及权限管理之角色说明的示例分析”这篇文章就分享到这里了,希望

内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/116460.html

(0)

相关推荐

  • 刘羽冲偶得古兵书翻译,刘羽冲偶得古兵书 赏析

    技术刘羽冲偶得古兵书翻译,刘羽冲偶得古兵书 赏析看看刘羽冲的表现:他偶然得过一部古兵书,苦读了一年左右,自己感觉可以统领十万军兵冲锋陷阵了刘羽冲偶得古兵书翻译。正巧当时乡里出现土匪,刘羽冲就自己训练乡兵与土匪们打仗,

    生活 2021年10月29日
  • 手机文件夹怎么弄,手机空白文件夹怎么创建

    技术手机文件夹怎么弄,手机空白文件夹怎么创建一手机文件夹怎么弄、在手机桌面上创建文件夹的方法:
    1、按住一个应用图标,移动到另一个应用图标上松开即可自动形成文件夹。
    2、在手机桌面双指捏合进入编辑模式,点击桌面整理,然后

    生活 2021年10月23日
  • 美国服务器提供的功能和优势

    技术美国服务器提供的功能和优势美国服务器相比其他地区的海外服务器拥有多种优势,包括安全性,速度和可靠性。美国服务器支持用户完全控制权限,并保护您的数据免受未经授权的访问。美国服务器还允许您轻松升级美配置及其服务。如有必要

    礼包 2021年12月16日
  • apachesuperset权限控制(apachesuperset使用方法)

    技术如何进行Apache Superset远程代码执行漏洞如何进行Apache Superset远程代码执行漏洞,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,

    攻略 2021年12月21日
  • MySQL server has gone away两种有效的解决办法

    技术MySQL server has gone away两种有效的解决办法MySQL server has gone away两种有效的解决办法,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决

    攻略 2021年12月3日
  • 如何使用C#算法解决求第n个数值问题

    技术如何使用C#算法解决求第n个数值问题这篇文章主要为大家展示了“如何使用C#算法解决求第n个数值问题”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“如何使用C#算法解决求第n

    攻略 2021年12月1日