5. MongoDB Learning Security and authentication

Source: Internet
Author: User
Tags mongodb

Each MongoDB library can have many users, only to open the user and have access to the library operation permissions to read and write operations, MONGODB security mechanism is: 1, first to establish a super user, can be authenticated by the super user and then create the corresponding library user target: 1, create a super user to manage ( Include create new user) 2, Super User authentication and then create a normal user to read and write the corresponding database version:> db.version () 3.4.71, using the Admin database > Use adminswitched to DB admin> show Collections second, create Superuser > Db.createuser ({User: ' admin ', pwd: ' 123 ', roles:[' root '}) successfully added User: {"user": " Admin "," Roles ": [" Root "]} third, view User rights > Db.system.users.find ()

Iv. MongoDB open authentication Test Super User # vi/usr/local/mongodb/mongodb.conf
Add auth = True Restart Service v. Test superuser authentication [[email protected] bin]# ./mongo> use adminswitched to DB admin> db.auth ("admin", "123") Note: Certification must also be the first use of the admin before the certification of six, in the AA database to create a normal user > Application aaswitched to DB AA > Db.createuser ({User: ' Test ', pwd: ' 123 ', roles:[' ReadWrite '}) successfully added User: {"user": "Test", "Roles": ["ReadWrite"]}

Test Normal user > Use aaswitched to DB aa> db.auth (' Test ', ' 123 ') 1

Summary: Currently MONGODB authentication of other roles do not understand, the latter need to refuel understanding MongoDB security and authentication

5. MongoDB Learning Security and authentication

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.