Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
Created July 24, 2017 09:25
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasrulhazim/10da3980c0e096e85a488e5a97add360 to your computer and use it in GitHub Desktop.
Save nasrulhazim/10da3980c0e096e85a488e5a97add360 to your computer and use it in GitHub Desktop.
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
Copy link

gjsman commented Nov 14, 2017

Where did you get this? Did you write it?

@gjsman
Copy link

gjsman commented Nov 14, 2017

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

@rvraj
Copy link

rvraj commented Mar 20, 2018

totally useful..!!

@art-lucas
Copy link

thanks a million!

@ace4love
Copy link

Saved me!! Thank you!!

@HughesShigatse
Copy link

dude, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment