tag (mongo)

archive

Mongo setting global admin user Mar
06
1
7

Auth is turned off by default for Mongo. To set a global admin you need to create an admin user and turn on auth.

If you want to additionally allow external connections you can change the bind ip from 127.0.0.1 that only allows for local connections.

/etc/mongod.conf

bind_ip = 0.0.0.0
port = 27017
auth = trueuse admin
db.addUser({user: "user", pwd: "pass", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]})

comments