MongoDB的未经授权的查询admin.system.users [英] MongoDB not authorized for query admin.system.users

查看:2703
本文介绍了MongoDB的未经授权的查询admin.system.users的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点新的MongoDB中,我使用MongoDB的v.2.4.Here的问题是,当我运行--auth参数的mongod,即使验证后我不能够进行简单的操作,如显示用户。但是,如果我没有--auth参数运行的mongod正常工作。

 >使用admin
切换到数据库管理员
> db.auth(dbadmin,输入mypassword)
1
>显示用户
**周四16年2月27日:50:17.695错误:{$ ERR:未经授权的查询admin.sys
tem.users,code:16550}在SRC /蒙戈/壳/ query.js:128 **


解决方案

首先,你应该要在本地主机上运行的mongod没有 - AUTH 并创建用户提供必要的 中的角色,你需要的。在你的情况,你应该添加 userAdminAnyDatabase userAdmin 的作用。比你可以用运行的mongod - AUTH 并通过此用户身份验证有 system.users 集合远程访问。结果
你可以读到这里

I am bit new to MongoDb and I am using MongoDb v.2.4.Here the problem is that when I run the mongod with --auth parameter, even after authenticating I am not able to perform simple operations such as "show users". But works fine if I run mongod without --auth parameter.

> use admin
switched to db admin
> db.auth("dbadmin","mypassword")
1
> show users
**Thu Feb 27 16:50:17.695 error: { "$err" : "not authorized for query on admin.sys
tem.users", "code" : 16550 } at src/mongo/shell/query.js:128**

Firstly you should to run mongod on localhost without --auth and create user with necessary roles that you needed. In your case you should add userAdminAnyDatabase or userAdmin role. Than you could run mongod with --auth and authenticate by this user for have remote access to system.users collections.
You could read about it here.

这篇关于MongoDB的未经授权的查询admin.system.users的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆