bajsicki.com/content/posts/misskey-resetting-admin-password.md
2024-09-27 20:20:35 +02:00

1.5 KiB

+++ title = "MissKey: Resetting Admin Password" publishDate = 2023-08-11T00:00:00+02:00 lastmod = 2024-09-27T20:20:20+02:00 tags = ["misskey", "admin", "postgres"] categories = ["tech"] draft = false meta = true [menu] [menu.posts] weight = 3002 identifier = "misskey-resetting-admin-password" +++

So recently I had the need to reset the admin password in MissKey.

Alas, there was no recovery email configured, nor other users on the instance, so I needed to do some digging in the database.

So here is the short of it.

  1. Log in with your misskey user into postgres (assuming that's what you're running MissKey on).
  2. Connect to the database.
  3. select * from "user" where "isAdmin" = true;
  4. Grab the userId for the user you're resetting the password for.
  5. select * from user_profile where "userId" = 'your-userId'; to confirm that you're getting the right info.
  6. Get the hashed password with bcrypt, such as: python -c 'import bcrypt; print(bcrypt.hashpw("new-password", bcrypt.gensalt(log_rounds=10)))'
  7. UPDATE user_profile SET password = 'hashed-password' WHERE "userId" = 'your-userId';

Notes:

  • Step 6 requires that you have python-bcrypt installed, and uses that library to do its thing.
  • There is a difference between single quotes, double quotes, and lowercase/ capitals. This is a quirk of psql, so make sure you get those right.

And... done.

Join the FSF.