Suddenly can't login; admin, users, etc. On a mature, stable Redmine instance
Added by Jonathan Lewis 2 months ago
I support 16 active Redmine instances for many years. Suddenly one instance that is old and rarely used can't be logged into with any ID including admin. "Invalid user or password"
Admin is a built-in user. Our other users are governed by LDAP. Nothing can login.
Nothing has been changed recently.
I saved off the SQL database and installed a fresh instance on the server... which was working fine... until I loaded the SQL database into it. Then the new instance wouldn't let admin login... same as before.
I suspect a corrupted SQL database... Is there anything I can do within the SQL editor (HeidiSQL)?
Has anyone seen this behavior before?
Replies (5)
RE: Suddenly can't login; admin, users, etc. On a mature, stable Redmine instance
-
Added by Ondrej Svejkovsky about 2 months ago
Hi Jonathan, this behavior suggests that the database might be corrupted, especially the users table or hashed password storage. Here’s how you can troubleshoot and possibly fix it within HeidiSQL (or any SQL editor):
1. Check for User Table Corruption
Run the following query in HeidiSQL to check if the users table is corrupted:
CHECK TABLE users;
If it reports corruption, attempt to repair it:
REPAIR TABLE users;
2. Reset Admin Password Directly in SQL
Try resetting the admin password manually in the database.
Here is an SQL query to insert the newadmin user into an existing Redmine database. It ensures that:¶
- The ID is unique – If ID 11 already exists, update it accordingly.
- The password is securely hashed – Redmine 4.x+ uses SHA1 with salt.
- The correct default values are set for a fresh admin user.
INSERT INTO `users` (`id`, `login`, `hashed_password`, `firstname`, `lastname`, `admin`, `status`, `last_login_on`, `language`, `auth_source_id`, `created_on`, `updated_on`, `type`, `mail_notification`, `salt`, `must_change_passwd`, `passwd_changed_on`, `twofa_scheme`, `twofa_totp_key`, `twofa_totp_last_used_at`, `twofa_required`) VALUES (11, 'newadmin', '1ea6bdce9715273b92a656075bd9dd95429e5bd7', 'New', 'Admin', 1, 1, NULL, 'en', NULL, NOW(), NOW(), 'User', 'only_my_events', '60f96f3c62285937e1c5eb0e3e9f3658', 0, NOW(), NULL, NULL, NULL, 0) ON DUPLICATE KEY UPDATE `login` = VALUES(`login`), `hashed_password` = VALUES(`hashed_password`), `firstname` = VALUES(`firstname`), `lastname` = VALUES(`lastname`), `admin` = VALUES(`admin`), `status` = VALUES(`status`), `updated_on` = NOW(), `salt` = VALUES(`salt`);
Login Credentials
- Username : newadmin
- Password : newpassword
Hope it helps.
Michael from https://www.redmine-x.com/
RE: Suddenly can't login; admin, users, etc. On a mature, stable Redmine instance
-
Added by Jonathan Lewis about 2 months ago
Thanks for the response. I agree with your assessment that the SQL database got corrupted somehow.
I tried the CHECK TABLE users; and received a message that the table was "ok". When I tried a repair... it said nothing to repair.
I tried your recommended method to reset admin password, but this redmine instance is on version 2.6 and certain variables in the queries are not recognized.
My plan now is to create a new instance and accept that the old database is gone. We keep 7 days worth of backups which would have saved me, but I didn't notice the problem until after 7 days had already passed.
RE: Suddenly can't login; admin, users, etc. On a mature, stable Redmine instance
-
Added by Ondrej Svejkovsky about 2 months ago
Hi Jonathan,
since you're using Redmine 2.6, the process should be even easier as Redmine 2.6 uses MD5 hashing with salt.
UPDATE users SET hashed_password = MD5(CONCAT('abc123', 'admin')), salt = 'abc123' WHERE login = 'admin';
Then you should be able to login using admin / admin.
Ondrej from https://www.redmine-x.com/
RE: Suddenly can't login; admin, users, etc. On a mature, stable Redmine instance
-
Added by Jonathan Lewis about 2 months ago
Thanks Ondrej,
I gave that a try, ran those SQL queries, restarted the processes, but no change. Could not login with admin/admin... or any other user.
RE: Suddenly can't login; admin, users, etc. On a mature, stable Redmine instance
-
Added by Ondrej Svejkovsky about 2 months ago
Hmmm... Strange. I guess the only option is to use a client such as PHPMmyAdmin and try to alter the hashed password and salt directly and inline.
Ondrej from https://www.redmine-x.com/