[SERVER-6101] Error when bootstrapping 2.1.x with auth from localhost Created: 15/Jun/12  Updated: 20/Jun/13  Resolved: 06/Jul/12

Status: Closed
Project: Core Server
Component/s: Security
Affects Version/s: 2.1.0, 2.1.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Abdul Alkhatib Assignee: Spencer Brody (Inactive)
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

osx-x86_64, linux-x86_64


Issue Links:
Duplicate
duplicates SERVER-4225 Adding first admin user to database v... Closed
Operating System: ALL
Participants:

 Description   

As of 2.1.0, when bootstrapping a server that is running with --auth, I get an error when adding the first admin user. The user does get added but an error is thrown:

> db.addUser('aaa' , 'aaa')
{
"user" : "aaa",
"readOnly" : false,
"pwd" : "23f8b034fedbdf7c2f1c184fbc5452c0",
"_id" : ObjectId("4fd92e5aee90c3265d5ff41d")
}
Wed Jun 13 17:20:42 uncaught exception: getlasterror failed:

{ "errmsg" : "need to login", "ok" : 0 }

 Comments   
Comment by auto [ 20/Jun/13 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: SERVER-6101 Remove no longer necessary try-catch from test
Branch: master
https://github.com/mongodb/mongo/commit/aae69729c55172dcf70081e6e5ce8650e9ac0dc2

Comment by Abdul Alkhatib [ 15/Jun/12 ]

Sorry if this was not clear but here is what i am doing/running into:

  • Start a mongod from scratch (no DB files/no users) with --auth
    [shell] mongod --auth
  • mongo to that server from localhost
    [shell] mongo
  • Add an admin user
    [mongo shell] db.addUser('foo', 'bar')

The user will be added but an error is thrown:

{ "user" : "foo", "readOnly" : false, "pwd" : "23f8b034fedbdf7c2f1c184fbc5452c0", "_id" : ObjectId("4fd92e5aee90c3265d5ff41d") }

Wed Jun 13 17:20:42 uncaught exception: getlasterror failed:

{ "errmsg" : "need to login", "ok" : 0 }

Thanks!

-abdul

Generated at Thu Feb 08 03:10:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.