在建立mongo的基本安全連線機制上 |
---|
其實會碰到一個問題 |
帳號與基本認證啟用之間 |
會有一個雞生蛋,蛋生雞的問題 |
在3T的技術章節Database Administration & Security裡 |
這篇MongoDB User Authentication: A Step-by-Step Guide |
的這一段話,我覺得最實用 |
Enable user authentication after creating the user administrator |
This straightforward approach requires the following steps: |
1.Launch your MongoDB server without authentication. |
這就是安裝好的預設狀態,ip 是聽127.0.0.1 |
帳號認證還沒啟動的時候 |
2.Create the system user administrator. |
直接建一個具root role的user |
3.Restart your MongoDB, this time with authentication enabled. You can now connect to your server as that user administrator. |
此時當然就是把ip及base security設上 |
然後重開DB Instance |
再來就是參照底下這兩篇的介紹 |
---|
MongoDB Users and Roles Explained – Part 1 |
MongoDB Users and Roles Explained – Part 2 |