Redmine: Recover admin account

I recently managed to install Redmine 2.5 on my Amazon EC2 Ubuntu server instance. No small feat, but more doable now than the last time I tried a couple of years ago.

Today I managed to eff up the admin account login (due to the fact that LastPass (or I) hadn’t saved the correct username), and apparently sending of email isn’t set up correctly either, so I couldn’t reset the password that way.

I tried using PHPMyAdmin, but Rails’ password hashing is more complex than just the relatively simple MD5 or SHA1 available in PHPMyAdmin.

I found some pretty old tips for resetting the admin user’s password in the Redmine forums and combined that with more recent Rails documentation to get this relatively easy way to fix it:

  • ssh into your instance.
  • cd into your Redmine root folder.
  • run rails console.
  • In the console, issue the following commands (assuming there’s just one admin user):
    • user = User.find(:first, :conditions => {:admin => true})
    • user.password, user.password_confirmation = “your_new_password”
    • user.save!
  • End the rails console session with Ctrl+D.

That’s it! Now you can log in with your_new_password.

(I realize not many will mess up the way I did and actually need this tip, but if just one or two find this useful, I’m happy.)