MongoDB:Read and write access to data and configuration is unrestricted.
部署環境: Ubuntu 16.04.1 LTS (GNU/Linux 4.13.0-36-generic x86_64)
WARNING: Access control is not enabled for the database.Read and write access to data and configuration is unrestricted.
剛建立資料庫沒有許可權的問題(就是當前狀態不安全),解決方法:
1.在控制檯輸入命名(前提/ data/db 路徑存在)
mongod --port 27017 --dbpath /data/db
2.重啟伺服器連線例項
mongo --port 27017
3.建立管理員
use admin
db.createUser(
{
user: "admin", //使用者名稱
pwd: "admin123", //密碼
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] //許可權
}
)
4.退出, 修改許可權
vi /etc/mongod.conf
修改如下:
net:
#port: 27017
bindIp: 0.0.0.0 //用於遠端伺服器的連線
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
security:
authorization: enabled //新增許可權設定
5.重啟服務
service mongod restart
- 重新連線
mongo 或者 mongo -u admin -p admin123
# 埠可以帶可以不帶
ok
如果新增使用者有許可權的問題參考此文章:
errmsg" : "not authorized on admin to execute command { listCollections: 1.0, filter: {}, $db: "admin" }",
如果不懂或者有什麼錯誤,歡迎下方評論
相關文章
- MongoDB Write ConcernMongoDB
- CSS :read-write 選擇器CSS
- SRAM的Write Assist與Read Assist
- How boltdb Write its Data?
- MongoDB 寫安全(Write Concern)MongoDB
- Permission denied:user=xxx,access=WRITE,inode=xxx
- Bypass McAfee Application Control--Write&Read ProtectionAPP
- mongodb批量操作, bulk_write,MongoDB
- 用 MongoTemplate 操作 documentDB 與 用 Spring Data MongoDB 操作 documentDB 有什麼不同,write concern,transactionSpringMongoDB
- Linux核心同步機制之(五):Read Write spin lock【轉】Linux
- SpringBoot 整合 Spring Data Mongodb 操作 MongoDB 詳解Spring BootMongoDB
- DevExpress v17.2新版亮點——Data AccessdevExpress
- SAP Data Intelligence API如何獲得Access TokenIntelAPI
- I/O上的等待事件 —— control file sequential read/control file parallel write事件Parallel
- 證明socket是全雙工,read,write是相互獨立的
- spring-data-mongodb常用操作SpringMongoDB
- iis 0x80070032 Cannot read configuration file because it exceeds the maximum file size
- hive建立分割槽表報錯AccessControlException Permission denied: user=NONE, access=WRITE, inodeHiveExceptionNone
- Mongodb write寫(增、刪、改)模組原始碼實現MongoDB原始碼
- [20201110]How to get the Data Guard broker configuration from a SQL query.txtSQL
- SAP Hybris和ABAP Netweaver裡的DAO(Data access object)Object
- 什麼是 SAP ABAP FDA - Fast Data Access 技術?AST
- error: RPC failed; curl 18 transfer closed with outstanding read data remainingErrorRPCAIREM
- spring data mongodb配置+月庫實現SpringMongoDB
- Spring Data MongoDB 操作 document DB 的詳細示例SpringMongoDB
- PHP設計模式-DAO (Data Access Objects) 資料訪問物件模式PHP設計模式Object物件
- mongodb核心原始碼實現及效能優化系列:Mongodb write寫(增、刪、改)模組原始碼實現MongoDB原始碼優化
- MySQL:網路斷開後執行的事務怎麼處理(read_timeout/write_timeout))MySql
- Git push時報錯:fatal: Could not read from remote repository. Please make sure you have the correct access rightsGitREM
- MONGODB03 - 分組計數/分組去重計數(基於 spring-data-mongodb)MongoDBSpring
- 執行新增和修改操作報錯connection is read-only. Queries leading to data modification are not allowed
- redis configurationRedis
- 【配置】伺服器遠端建立索引報錯access denied ("java.io.FilePermission""........\IKAnalyzer.cfg.xml""read"伺服器索引JavaXML
- 在Spring Data MongoDB中實現關係建模 - spring.ioSpringMongoDB
- Spring認證中國教育管理中心-Spring Data MongoDB教程SpringMongoDB
- MySQL double writeMySql
- [Javascript] Write .call()JavaScript
- hio_write