Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-126

Mongorestore can fail with authentication if --drop is specified

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: mongorestore
    • Labels:
    • 1
    • 1,674

      Mongorestore can fail during restore if the --drop is specified and the user is not in the dump restore file:

      mongorestore --dir /data/db/dumprestore_auth3_external/foo/ --db foo --authenticationDatabase admin --username restore --password <pass> --drop --restoreDbUsersAndRoles
       m27000| 2014-06-06T15:21:21.577-0400 [initandlisten] connection accepted from 127.0.0.1:51586 #7 (2 connections now open)
      sh5180| connected to: localhost:27000
       m27000| 2014-06-06T15:21:21.578-0400 [conn7]  authenticate db: admin { authenticate: 1, nonce: "xxx", user: "restore", key: "xxx" }
      sh5180| 2014-06-06T15:21:21.579-0400 Restoring users for the foo database to admin.system.users
      sh5180| 2014-06-06T15:21:21.579-0400 	going into namespace [admin.system.users]
      sh5180| 1 objects found
       m27000| 2014-06-06T15:21:21.580-0400 [conn7] build index on: admin.tempusers properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "admin.tempusers" }
       m27000| 2014-06-06T15:21:21.580-0400 [conn7] 	 added index to empty collection
       m27000| 2014-06-06T15:21:21.581-0400 [conn7] Removed deleted user restore@admin from session cache of user information.
       m27000| 2014-06-06T15:21:21.581-0400 [conn7] Unauthorized not authorized on admin to execute command { drop: "tempusers" }
      sh5180| 2014-06-06T15:21:21.581-0400 	Creating index: { key: { _id: 1 }, name: "_id_", ns: "admin.system.users" }
      sh5180| Error creating index admin.system.users: 13 err: "not authorized to create index on admin.system.users"
       m27000| 2014-06-06T15:21:21.810-0400 [conn7] end connection 127.0.0.1:51586 (1 connection now open)
       m27000| 2014-06-06T15:21:21.811-0400 [conn1] Removed deleted user root@admin from session cache of user information.
       m27000| 2014-06-06T15:21:21.811-0400 [conn1]  authenticate db: foo { authenticate: 1, nonce: "xxx", user: "user", key: "xxx" }
       m27000| 2014-06-06T15:21:21.812-0400 [conn1] Failed to authenticate user@foo with mechanism MONGODB-CR: AuthenticationFailed key mismatch
      Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 }
       m27000| 2014-06-06T15:21:21.812-0400 [conn1] assertion 13 not authorized for query on foo.bar ns:foo.bar query:{}
       m27000| 2014-06-06T15:21:21.812-0400 [conn1]  ntoskip:0 ntoreturn:-1
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            jonathan.abrahams Jonathan Abrahams
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: