user1954544
user1954544

Reputation: 1687

MongoDB, MySQL-like authentication

I search through the manual but no result.

By default we can manage all database because we run it on localhost. (am I right?)

For each database we can setup-up custom users or create global admins. But how can i login under this users? (i want to see the access difference to understand how it works)

In general I want to create system looks like MySQL. No external access to it, simple creation of users to custom db. Access only from localhost. How can I do this?

Upvotes: 1

Views: 207

Answers (1)

vaettchen
vaettchen

Reputation: 7659

By default we can manage all database because we run it on localhost. (am I right?)

Yes, the 'localhost bypass' can be disabled by starting the daemon with

mongod --setParameter enableLocalhostAuthBypass=0

But how can I login under this users?

> use myDB
> db.auth( "myUser", "myPassword" )

This is assuming that you have created the user already.

Access from localhost only you would control via your firewall or starting the daemon with

mongod --bind_ip 127.0.0.1

The MongoDB documentation has a complete, albeit a bit difficult to understand documentation.

Upvotes: 3

Related Questions