|
[sgolemon] – so, using test user kaytest with readWrite permission on test db, I was expecting a list of dbs (well, test actually) but still get auth errors:
~/mongo $ ./mongodb-4.1.6/bin/mongo -u kaytest --authenticationDatabase test -p abc123
|
MongoDB shell version v4.1.6-103-g35da9da
|
connecting to: mongodb://127.0.0.1:27017/?authSource=test&gssapiServiceName=mongodb
|
Implicit session: session { "id" : UUID("9c9157cc-5b2d-4d95-975b-170137e1a558") }
|
MongoDB server version: 3.6.9
|
WARNING: shell and server versions do not match
|
> show dbs
|
2018-12-12T17:26:05.590-0500 E QUERY [js] Error: listDatabases failed:{
|
"ok" : 0,
|
"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, filter: {}, lsid: { id: UUID(\"9c9157cc-5b2d-4d95-975b-170137e1a558\") }, $db: \"admin\" }",
|
"code" : 13,
|
"codeName" : "Unauthorized"
|
} :
|
Running connectionStatus returns:
> db.runCommand({ connectionStatus: 1, showPrivileges: true })
|
{
|
"authInfo" : {
|
"authenticatedUsers" : [
|
{
|
"user" : "kaytest",
|
"db" : "test"
|
}
|
],
|
"authenticatedUserRoles" : [
|
{
|
"role" : "readWrite",
|
"db" : "test"
|
}
|
],
|
"authenticatedUserPrivileges" : [
|
{
|
"resource" : {
|
"db" : "test",
|
"collection" : ""
|
},
|
"actions" : [
|
"changeStream",
|
"collStats",
|
"convertToCapped",
|
"createCollection",
|
"createIndex",
|
"dbHash",
|
"dbStats",
|
"dropCollection",
|
"dropIndex",
|
"emptycapped",
|
"find",
|
"insert",
|
"killCursors",
|
"listCollections",
|
"listIndexes",
|
"planCacheRead",
|
"remove",
|
"renameCollectionSameDB",
|
"update"
|
]
|
},
|
{
|
"resource" : {
|
"db" : "test",
|
"collection" : "system.indexes"
|
},
|
"actions" : [
|
"changeStream",
|
"collStats",
|
"dbHash",
|
"dbStats",
|
"find",
|
"killCursors",
|
"listCollections",
|
"listIndexes",
|
"planCacheRead"
|
]
|
},
|
{
|
"resource" : {
|
"db" : "test",
|
"collection" : "system.js"
|
},
|
"actions" : [
|
"changeStream",
|
"collStats",
|
"convertToCapped",
|
"createCollection",
|
"createIndex",
|
"dbHash",
|
"dbStats",
|
"dropCollection",
|
"dropIndex",
|
"emptycapped",
|
"find",
|
"insert",
|
"killCursors",
|
"listCollections",
|
"listIndexes",
|
"planCacheRead",
|
"remove",
|
"renameCollectionSameDB",
|
"update"
|
]
|
},
|
{
|
"resource" : {
|
"db" : "test",
|
"collection" : "system.namespaces"
|
},
|
"actions" : [
|
"changeStream",
|
"collStats",
|
"dbHash",
|
"dbStats",
|
"find",
|
"killCursors",
|
"listCollections",
|
"listIndexes",
|
"planCacheRead"
|
]
|
}
|
]
|
},
|
"ok" : 1
|
}
|
|