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" }",
如果不懂或者有什麼錯誤,歡迎下方評論
相關文章
- data file int write和db file sequential read個人想法
- HDFS read and write
- write&read&open
- nodejs read/write fileNodeJS
- Data Guard物理備庫read/write後,切換回備庫狀態
- ZT:oracle10g Data Guard新特性:物理備庫也可以read/writeOracle
- open physical standby 為read write
- How boltdb Write its Data?
- MongoDB Write Concern整理MongoDB
- CSS :read-write 選擇器CSS
- pread,pwrite,read,write區別
- direct path read/write等待的分析
- SRAM的Write Assist與Read Assist
- 當從READ ONLY到READ WRITE都做什麼了
- data gurad物理備份方式下以READ ONLY/WRITE模式開啟物理STANDBY模式
- mongodb批量操作, bulk_write,MongoDB
- MongoDB 寫安全(Write Concern)MongoDB
- Setting the Data Protection Mode of a Data Guard Configuration
- No read or write permission to ORACLE_HOME/.patch_storageOracle
- 表空間的狀態(二) - read/write
- Seed Database (pdb$seed) - Read Write OR Read Only Mode in Oracle Database 12cDatabaseOracle
- Oracle常見等待事件之direct path read/writeOracle事件
- Cache the Data Dictionary for Fast Access (264)AST
- 用 MongoTemplate 操作 documentDB 與 用 Spring Data MongoDB 操作 documentDB 有什麼不同,write concern,transactionSpringMongoDB
- [轉載]Oracle等待事件Data file init writeOracle事件
- Bypass McAfee Application Control--Write&Read ProtectionAPP
- Permission denied:user=xxx,access=WRITE,inode=xxx
- 【效能調整】等待事件(六) direct path read&write事件
- 解決direct path read 與 direct path write問題
- 模擬data block lost write的簡單方法BloC
- Pure_C_Read and Write PPM、PGM、PBM Three Image File FormatsORM
- mysql 5.5引數--innodb_read(write)_io_threadsMySqlthread
- View and Data API tips: 快取Access TokenViewAPI快取
- Linux核心同步機制之(五):Read Write spin lock【轉】Linux
- Permission denied: user=root, access=WRITE, inode="/":hadoopuser:supergroup:drwxr-xr-xHadoop
- 【蓋國強】Oracle Wait Event:Data file init writeOracleAI
- Mongodb write寫(增、刪、改)模組原始碼實現MongoDB原始碼
- DevExpress v17.2新版亮點——Data AccessdevExpress