Reputation: 13394
I'm using mongodb on 64Bit and 32Bit Linux servers with same configuration, where the option auth=true
is set in both config files.
While the 64Bit system required an authentication to run commands like show users
or show collections
, the 32Bit version gives you all the requested informations without running db.auth()
before.
It looks like, the 32 Bit version ignores the auth=true
option at the config file.
So: how can I enable auth for mongodb running on an 32Bit system?
Upvotes: 0
Views: 1128
Reputation: 152
I finished this,the role is necessary
db.createUser(
{
user: "youloginname",
pwd: "123456",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
Upvotes: 0
Reputation: 36784
The 32bit version should support authentication just fine. But it is possible that:
-f /etc/mongodb.conf
as option when starting MongoDB) or you can specify --auth
on the command linedb.auth()
.admin
database defined. Without this, you can always connect on localhost.Upvotes: 2
Reputation: 13394
The point is, that authentication is disabled because there is no db users added, only users for a specific database. Connecting to this database using localhost results in an "auth"-free environment. (see for this also the answer from @Derick which point to a possible reason.)
To come back to the question:
So: how can I enable auth for mongodb running on an 32Bit system?
The point is: the auth is active, but not for connects from localhost. To enable auth for connects from localhost, the following startup option is needed:
enableLocalhostAuthBypass=0
Upvotes: 0