Security Reference安全参考

On this page本页内容

The following lists the security related methods available in the mongo shell as well as additional security reference material.以下列出了mongo shell中可用的安全相关方法以及其他安全参考资料

Security Methods in the mongo Shellmongo Shell中的安全方法

User Management and Authentication Methods用户管理和认证方法

Name名称Description描述
db.auth() Authenticates a user to a database.向数据库验证用户身份。
db.changeUserPassword() Changes an existing user’s password.更改现有用户的密码。
db.createUser() Creates a new user.创建一个新用户。
db.dropUser() Removes a single user.删除单个用户。
db.dropAllUsers() Deletes all users associated with a database.删除与数据库关联的所有用户。
db.getUser() Returns information about the specified user.返回有关指定用户的信息。
db.getUsers() Returns information about all users associated with a database.返回与数据库关联的所有用户的信息。
db.grantRolesToUser() Grants a role and its privileges to a user.将角色及其权限授予用户。
db.removeUser() Deprecated. 不赞成。Removes a user from a database.从数据库中删除用户。
db.revokeRolesFromUser() Removes a role from a user.从用户中删除角色。
db.updateUser() Updates user data.更新用户数据。
passwordPrompt() Prompts for the password as an alternative to specifying passwords directly in various mongo shell user authentication/management methods.提示输入密码,以替代在各种mongo shell用户身份验证/管理方法中直接指定密码。

Role Management Methods角色管理方法

Name名称Description描述
db.createRole() Creates a role and specifies its privileges.创建角色并指定其权限。
db.dropRole() Deletes a user-defined role.删除用户定义的角色。
db.dropAllRoles() Deletes all user-defined roles associated with a database.删除与数据库关联的所有用户定义的角色。
db.getRole() Returns information for the specified role.返回指定角色的信息。
db.getRoles() Returns information for all the user-defined roles in a database.返回数据库中所有用户定义角色的信息。
db.grantPrivilegesToRole() Assigns privileges to a user-defined role.为用户定义的角色分配权限。
db.revokePrivilegesFromRole() Removes the specified privileges from a user-defined role.从用户定义的角色中删除指定的权限。
db.grantRolesToRole() Specifies roles from which a user-defined role inherits privileges.指定用户定义的角色从中继承权限的角色。
db.revokeRolesFromRole() Removes inherited roles from a role.从角色中删除继承的角色。
db.updateRole() Updates a user-defined role.更新用户定义的角色。

Security Reference Documentation安全参考文件

system.roles Collection集合
Describes the content of the collection that stores user-defined roles.描述存储用户定义角色的集合的内容。
system.users Collection集合
Describes the content of the collection that stores users’ credentials and role assignments.描述存储用户凭据和角色分配的集合的内容。
Resource Document资源文件
Describes the resource document for roles.描述角色的资源文档。
Privilege Actions权限操作
List of the actions available for privileges.权限可用操作的列表。