Skip to content

Instantly share code, notes, and snippets.

View uhkey's full-sized avatar
🪼
kie.ac

Kieran Schuler uhkey

🪼
kie.ac
View GitHub Profile

Keybase proof

I hereby claim:

  • I am uhkey on github.
  • I am k1eran (https://keybase.io/k1eran) on keybase.
  • I have a public key ASCgjAcOYAPY8_dEuJK7EijoowBBkY1rnVkjtAMS-LVwLAo

To claim this, I am signing this object:

@uhkey
uhkey / securing-mongodb-auth.txt
Last active February 7, 2022 19:10
Securing self-hosted MongoDB with username and password
1. Add an Administrator User.
To add an Administrative user, you'll need to be first connected to the Mongo shell.
From here, connect to the default admin database, you can do this by running "use admin" in the Mongo shell.
Now, run "db.createUser({ user: "username", pwd: passwordPrompt(), roles: [ { role: "userAdminAnyDatabase", db: "admin", "readWriteAnyDatabase"}]})"
If this is ran correctly, you'll see a prompt to enter a password, enter a password of your choice here.
You'll see an output similar to the one below: