dokku / dokku-mongo

a mongo plugin for dokku
MIT License
177 stars 32 forks source link

Error: couldn't add user: not authorized on admin to execute command #54

Closed kaby76 closed 8 years ago

kaby76 commented 8 years ago

Hi Folks,

I'm trying to get Restheart to work with this plugin. I've got it to the point where I'm trying to get "http://localhost:8080/" from the server. Unfortunately, the Mongo plugin returns 'The full response is { "ok" : 0.0, "errmsg" : "not authorized on admin to execute command { listDatabases: 1 }", "code" : 13 }'.

I then try to bypass the Restheart server, and just connect to the Dokku/Mongo plugin via telnet directly using 'dokku mongo:connect kendb'. I then try the command to show databases, but that also fails:

show databases 2016-03-30T15:19:24.865+0000 E QUERY [thread1] Error: listDatabases failed:{ "ok" : 0, "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }", "code" : 13 } : _getErrorWithCode@src/mongo/shell/utils.js:23:13 Mongo.prototype.getDBs@src/mongo/shell/mongo.js:53:1 shellHelper.show@src/mongo/shell/utils.js:700:19 shellHelper@src/mongo/shell/utils.js:594:15 @(shellhelp2):1:1

I can't do a 'show users' either. So, something is obviously not correct with the installation and/or configuration.

--Ken

kaby76 commented 8 years ago

Reading the code, https://github.com/dokku/dokku-mongo/blob/master/commands, I now see that two users are created: 'admin', which has userAdminAnyDatabase privileges, and 'kendb', which has eadWrite privileges only to the Mongo database called 'kendb'. So, this makes sense.