19
0
Fork 0

Procédure pour modifier mot de passe `mongoAdmin`

This commit is contained in:
abenmiloud 2021-10-06 17:30:18 +02:00
parent 9ab54a9184
commit 47d2b265b5
1 changed files with 33 additions and 0 deletions

View File

@ -743,3 +743,36 @@ env.MONGO_DB_URI mongodb://mongoMonitoring:PASSWORD@localhost:27017/admin
### NRPE : check_mongo
TODO
## FAQ
### Modifier mot de passe `mongoAdmin`
On va arrêter MongoDB et démarrer le service à la main en *background*.
```bash
systemctl stop mongod.service
sudo -u mongodb /usr/bin/mongod --config /etc/mongod.conf --noauth &
mongo
```
Dans le *shell* MongoDB:
```js
use admin;
db.createUser( { user: "mongoAdmin", pwd: "MOT_DE_PASSE", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } )
exit
```
Une fois sorti du *shell* MongoDB, on tue le service démarré à la main et on démarre MongoDB normalement:
```bash
kill %%
systemctl start mongod.service
```
Pour vérifier si le mot de passe fonctionne:
```bash
mongo -u mongoAdmin -p'MOT_DE_PASSE'
```