Reset password in matrix synapse

By | 4th June 2019

To reset the password of matrix user in debian

After login as root. Change the user to postgres

#su postgres

At the postgres prompt connect to synapse database and update users table with new hash. generate the hash with hash_password command

$hash_password
Password: <hidden>
Confirm password: <hidden>
$2b$12$eGgHG99FQ1O9Q8jSnwOJ2e88tND7nznMctJcASV.Is655Hnr7ZFtG <example output>
$psql
postgres=# \c synapsedb;
synapsedb=# select name from users where name = '@<username>:<domain>';
[This will show if the user exists]
synapsedb=# UPDATE users SET password_hash = '$2b$12$eGgHG99FQ1O9Q8jSnwOJ2e88tND7nznMctJcASV.Is655Hnr7ZFtG WHERE name='@<username>:<domain>';'