lolski
lolski

Reputation: 17521

Properly set up a read only user in MongoDB 3.0?

I have created a user for my database dbase with a read role with the following command: db.createUser({user: "user" , pwd: "password" , roles: [{role: "read", db: "dbase"}] })

The problem is he can still insert and remove a document from the collection. How do I properly set up a read only user in MongoDB?

Upvotes: 4

Views: 936

Answers (1)

Michaël Perrin
Michaël Perrin

Reputation: 6268

Allright, I found it.

You have to enable client access control by doing the following:

  1. Edit the /etc/mongod.conf file
  2. Add the following lines

security: authorization: enabled

  1. Restart MongoDB:

sudo service mongodb restart

Upvotes: 3

Related Questions