MongoDB - admin user not authorized -


i trying add authorization mongodb.
doing on linux mongodb 2.6.1.
mongod.conf file in old compatibility format
(this how came installation).

1) created admin user described here in (3)

http://docs.mongodb.org/manual/tutorial/add-user-administrator/

2) edited mongod.conf uncommenting line

auth = true

3) rebooted mongod service , tried login with:

/usr/bin/mongo localhost:27017/admin -u sa -p pwd

4) can connect says upon connect.

mongodb shell version: 2.6.1 connecting to: localhost:27017/admin welcome mongodb shell! current date/time is: thu may 29 2014 17:47:16 gmt-0400 (edt) error while trying show server startup warnings: not authorized on admin execute command { getlog: "startupwarnings" } 

5) seems sa user created has no permissions @ all.

root@test02:~# mc mongodb shell version: 2.6.1 connecting to: localhost:27017/admin welcome mongodb shell! current date/time is: thu may 29 2014 17:57:03 gmt-0400 (edt) error while trying show server startup warnings: not authorized on admin execute command { getlog: "startupwarnings" } [admin] 2014-05-29 17:57:03.011 >>> use admin switched db admin [admin] 2014-05-29 17:57:07.889 >>> show collections 2014-05-29t17:57:10.377-0400 error: {         "$err" : "not authorized query on admin.system.namespaces",         "code" : 13 } @ src/mongo/shell/query.js:131 [admin] 2014-05-29 17:57:10.378 >>> use test switched db test [test] 2014-05-29 17:57:13.466 >>> show collections 2014-05-29t17:57:15.930-0400 error: {         "$err" : "not authorized query on test.system.namespaces",         "code" : 13 } @ src/mongo/shell/query.js:131 [test] 2014-05-29 17:57:15.931 >>> 

what problem? repeated whole procedure 3 times and
think did specified in mongodb docs. doesn't work.
expecting sa user authorized that
can create other users , give them more specific permissions.

i scratching head around same issue, , worked after set role root when adding first admin user.

use admin db.createuser(   {     user: "admin",     pwd: "password",     roles: [ { role: "root", db: "admin" } ]   } ); exit;  

for complete authentication setting reference, see steps i've compiled after hours of research on internet.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -