前提・実現したいこと
rootロールを持ったユーザは全てのデータベース・コレクションにアクセス可能と想定していましたが
一般ユーザが作成したコレクションにアクセスを試みるとエラー(Unauthorized)となり失敗しました。
rootロールはLinuxにおけるrootユーザと同じく何でも出来るロールと思っているのですが認識に相違あるでしょうか?
原因調査にご協力いただけますと幸いです。
発生している問題・エラーメッセージ
[root@testsv01 ~]# mongo testdb2 -u root --authenticationDatabase admin MongoDB shell version v4.2.2 Enter password: connecting to: mongodb://127.0.0.1:27017/testdb2?authSource=admin&compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("5ffbaeca-3b8d-4415-94bf-562cd3ae478c") } MongoDB server version: 4.2.2 > show databases; admin 0.000GB config 0.000GB local 0.000GB testdb 0.000GB testdb2 0.000GB > db; testdb2 > show collections; testcollection > db.testcollection.find({}); Error: error: { "ok" : 0, "errmsg" : "not authorized on testdb2 to execute command { find: \"testcollection\", filter: {}, lsid: { id: UUID(\"5ffbaeca-3b8d-4415-94bf-562cd3ae478c\") }, $db: \"testdb2\" }", "code" : 13, "codeName" : "Unauthorized" } > exit; [root@testsv01 ~]#
※testdb2にreadWriteロールを持ったユーザでは「db.testcollection.find({});」でデータを参照できます。
補足情報(FW/ツールのバージョンなど)
[root@testsv01 ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@testsv01 ~]# [root@testsv01 ~]# rpm -qa | grep mongo mongodb-org-server-4.2.2-1.el7.x86_64 mongodb-org-shell-4.2.2-1.el7.x86_64 mongodb-org-mongos-4.2.2-1.el7.x86_64 mongodb-org-4.2.2-1.el7.x86_64 mongodb-org-tools-4.2.2-1.el7.x86_64 [root@testsv01 ~]#
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/21 18:22