Description
On Linux an initial admin user can be added over a Unix domain socket:
MongoDB shell version: 2.2.3
|
connecting to: /tmp/mongodb-27017.sock:27017/test
|
repl0:PRIMARY> use admin
|
switched to db admin
|
repl0:PRIMARY> db.runCommand('getCmdLineOpts')
|
{
|
"argv" : [
|
"./mongod",
|
"--dbpath",
|
"/storage/data/rs0",
|
"--port",
|
"27017",
|
"--replSet",
|
"repl0",
|
"--keyFile",
|
"/home/behackett/work/key"
|
],
|
"parsed" : {
|
"dbpath" : "/storage/data/rs0",
|
"keyFile" : "/home/behackett/work/key",
|
"port" : 27017,
|
"replSet" : "repl0"
|
},
|
"ok" : 1
|
}
|
repl0:PRIMARY> db.sytem.users.find()
|
repl0:PRIMARY> db.addUser('admin', 'pass')
|
{
|
"user" : "admin",
|
"readOnly" : false,
|
"pwd" : "e4e538f5dcb52537cad02bbf8491693c",
|
"_id" : ObjectId("511583981babfde6e653926b")
|
}
|
addUser succeeded, but cannot wait for replication since we no longer have auth
|
|
|
> db.auth('admin', 'pass')
|
1
|
repl0:PRIMARY>
|
On OSX this isn't possible:
./mongo --host /tmp/mongodb-27017.sock
|
MongoDB shell version: 2.2.3
|
connecting to: /tmp/mongodb-27017.sock:27017/test
|
> use admin
|
switched to db admin
|
> db.runCommand('getCmdLineOpts')
|
{ "errmsg" : "need to login", "ok" : 0 }
|
> db.system.users.find()
|
error: {
|
"$err" : "unauthorized db:admin ns:admin.system.users lock type:1 client:",
|
"code" : 10057
|
}
|
>
|
Using a regular socket works fine:
./mongo
|
MongoDB shell version: 2.2.3
|
connecting to: test
|
> use admin
|
switched to db admin
|
> db.runCommand('getCmdLineOpts')
|
{
|
"argv" : [
|
"./mongod",
|
"--dbpath",
|
"/Users/behackett/data/db",
|
"--auth"
|
],
|
"parsed" : {
|
"auth" : true,
|
"dbpath" : "/Users/behackett/data/db"
|
},
|
"ok" : 1
|
}
|
I've tried this with both replica sets and a single mongod instance. The behavior is the same in both cases.
Attachments
Issue Links
- is duplicated by
-
SERVER-13893 Unix domain socket support should be both AF_UNIX and AF_LOCAL
-
- Closed
-
- links to