MongoDB intermediate-MongoDB Permissions

Source: Internet
Author: User
By default, MongoDB does not need to enter the User and password, so the client can log on. This security problem is serious. There are also many examples on the Internet, but there are also a lot of details

By default, MongoDB does not need to enter the User and password, so the client can log on. This security problem is serious. There are also many examples on the Internet, but there are also a lot of details

By default, MongoDB does not need to enter the User and password, so the client can log on. This security problem is serious.

There are also many examples on the Internet, but there are also many details that many people have not noticed me here by the way.

The following describes how to set the user name and password.


When adding a user, you must

1. If you have the relevant permissions (I will talk about it later)

2. When -- auth is not added to mongod. (If the permission is added, the following situations may occur if you add the permission)

Therefore, when adding a user, we must first add a super admin when -- auth is not added.

After the service is started, enter./mongo

In this way, it indicates that the permission has been successfully created. Then, let's try the permission.

Without -- auth, you can access admin's two favorite default tables.

  • > Db. system. users. find ()
  • Created successfully.

    Add the -- auth option to the service.

    Go to./mongo.

    You can see that you have no access permission.

    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.