From 1b3aa9d318cec0606d854ed313c4a27be5514c34 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Sat, 7 Dec 2024 19:54:52 +0000 Subject: [PATCH] Update mongodb debian --- mongodb-debian.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mongodb-debian.md b/mongodb-debian.md index 205a808..3ee09e2 100644 --- a/mongodb-debian.md +++ b/mongodb-debian.md @@ -12,4 +12,14 @@ ### Hardening MongoDB 1. Start mongod without authentication and drop into a shell `sudo systemctl start mongod & mongosh` 2. Switch over to the admin database `use admin` -3. Create the administrative user: \ No newline at end of file +3. Create the administrative user: +```db.createUser( + { + user: "myUserAdmin", + pwd: passwordPrompt(), // or cleartext password + roles: [ + { role: "userAdminAnyDatabase", db: "admin" }, + { role: "readWriteAnyDatabase", db: "admin" } + ] + } +)``` \ No newline at end of file