configuring login in MongoDB CE: uncaught exception: password can't be empty

2,281 views
Skip to first unread message

Charles Federspiel

unread,
Sep 16, 2013, 3:09:37 PM9/16/13
to mongod...@googlegroups.com
Hi Mongo Users,

I configured and confirmed a replicaSet. I would like to secure my instance, so following the instructions on creating my first user, from the localhost on which all my instances are running, I ran:

db = db.getSiblingDB('admin');
db.addUser({user:"cjfadmin",pwd:"changeit",roles:["userAdminAnyDatabase"]});

And MongoDB responded:
uncaught exception: password can't be empty

I'm running mongodb-osx-x86_64-2.4.3.

Any help would be greatly appreciated!
Charlie

Jeff Lee

unread,
Sep 16, 2013, 4:23:15 PM9/16/13
to mongod...@googlegroups.com
I wasn't able to reproduce your error...are you running these commands from a script of some kind or from within the mongo shell?  Can you paste your terminal output?

$ mongo
MongoDB shell version: 2.4.3
connecting to: test
> db = db.getSiblingDB('admin');
admin
> db.addUser({user:"cjfadmin",pwd:"changeit",roles:["userAdminAnyDatabase"]});
{
        "user" : "cjfadmin",
        "pwd" : "cfb60134e87137826722d5b414c8455d",
        "roles" : [
                "userAdminAnyDatabase"
        ],
        "_id" : ObjectId("523767c7a477e074dd1bbaa1")
}

Charles Federspiel

unread,
Sep 16, 2013, 5:01:29 PM9/16/13
to mongod...@googlegroups.com
Thanks Jeff,
My output was different:
jglidden-t420:~ charliefederspiel$ mongo --port 27017
MongoDB shell version: 2.2.0
connecting to: 127.0.0.1:27017/test

I had no idea I had two versions of Mongo installed on my mac!
I changed my client startup command and it worked:
$MONGO_HOME/bin/mongo --port 27017
MongoDB shell version: 2.4.3
connecting to: 127.0.0.1:27017/test

 Thanks for your help! I was able to create my admin and db users when the mongo client version matched the daemon version.
C
Reply all
Reply to author
Forward
0 new messages