1.5 KiB
1.5 KiB
+++ title = "MissKey: Resetting Admin Password" publishDate = 2023-08-11T00:00:00+02:00 lastmod = 2024-09-27T21:05:37+02:00 tags = ["misskey", "admin", "postgres"] categories = ["tech"] draft = false meta = true type = "list" [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.
- Log in with your misskey user into postgres (assuming that's what you're running MissKey on).
- Connect to the database.
select * from "user" where "isAdmin" = true;
- Grab the
userId
for the user you're resetting the password for. select * from user_profile where "userId" = 'your-userId';
to confirm that you're getting the right info.- Get the hashed password with
bcrypt
, such as:python -c 'import bcrypt; print(bcrypt.hashpw("new-password", bcrypt.gensalt(log_rounds=10)))'
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.