Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rocket.Chat: Reset User Details

Connect to MongoDB

sudo /snap/rocketchat-server/current/bin/mongo

Select Rocket.Chat Database

use parties

Display all usesrs

db.getCollection('users').find({})

Get User's ID

db.getCollection('users').find({username:'admin'})

Grab the _id to be use in next step.

Update Selected User's Password to 12345

db.getCollection('users').update({_id:"admin"}, { $set: {"services" : { "password" : {"bcrypt" : "$2a$10$n9CM8OgInDlwpvjLKLPML.eizXIzLlRtgCh3GRLafOdR9ldAUh/KG" } } } })

Now you should be ready with new password.

Update User's Role to Admin

You may want to update user's role to admin. Do the following:

db.users.update({username:'admin'}, {$set: {'roles' : [ "admin" ]}})
@gjsman

This comment has been minimized.

Copy link

@gjsman gjsman commented Nov 14, 2017

Where did you get this? Did you write it?

@gjsman

This comment has been minimized.

Copy link

@gjsman gjsman commented Nov 14, 2017

Wait... sorry, someone sent me the link. 👍

@rvraj

This comment has been minimized.

Copy link

@rvraj rvraj commented Mar 20, 2018

totally useful..!!

@art-lucas

This comment has been minimized.

Copy link

@art-lucas art-lucas commented Nov 19, 2020

thanks a million!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.