adding a user in admin with role userAdminAnyDatabase during upgrade in 26

71 views
Skip to first unread message

arun....@gmail.com

unread,
Feb 23, 2016, 2:55:48 AM2/23/16
to mongodb-user

Actually , I am running a mongodb 2.4 with auth enabled  and wants to upgrade to 2.6 

well instructions in upgarde 2.6 says.. that

Before beginning the upgrade process for a deployment that uses authentication and authorization:

  • Ensure that at least one user exists in the admin database with the role userAdminAnyDatabase.
  • then upgrade binaries
  • then run athorization schema format if needed

so i have to add user with the role userAdminAnyDatabase in 2.4  before copies binaries of 2.6 ?


in cuurent 2.4 shell added user with role userAdminAnyDatabase and then schema upgrade with userAdminAnyDatabase role after coping binaries of 2.6

> db.addUser( { user: "a", pwd: "pass", roles: [ "userAdminAnyDatabase" ] } )


is it the right way.. do i need to add read write access as well?  i think i might not get below error if i go into admin database with role userAdminAnyDatabase



> show collections
2016-02-22T18:51:10.765-0500 error: {
"$err" : "not authorized for query on oasis.system.namespaces",
"code" : 13
} at src/mongo/shell/query.js:131

Dwight Merriman

unread,
Feb 23, 2016, 4:10:33 PM2/23/16
to mongodb-user

On Tuesday, February 23, 2016 at 2:55:48 AM UTC-5, wrote:

Actually , I am running a mongodb 2.4 with auth enabled  and wants to upgrade to 2.6 

well instructions in upgarde 2.6 says.. that

Before beginning the upgrade process for a deployment that uses authentication and authorization:

  • Ensure that at least one user exists in the admin database with the role userAdminAnyDatabase.
  • then upgrade binaries
  • then run athorization schema format if needed

so i have to add user with the role userAdminAnyDatabase in 2.4  before copies binaries of 2.6 ?


I assume so given those instructions.  I believe 2.4 has a userAdminAnyDatabase role, as I see some docs on it when I view the 2.4 version of the docs.  

is it the right way.. do i need to add read write access as well?  i think i might not get below error if i go into admin database with role userAdminAnyDatabase


The 2.6 docs say "Following the policy of least privilegeuserAdmin and userAdminAnyDatabase confer no additional privileges."  https://docs.mongodb.org/v2.6/tutorial/add-user-administrator/

also be sure (obviously) to log in as the user of relevance when invoking the mongo shell.

Reply all
Reply to author
Forward
0 new messages