redmine密码忘记了,折腾了一晚上

人老了记忆力差,一些长时间没登陆过的账号就想不起密码。于是redmine的账号就忘记了。登陆界面上倒是有一个通过邮件找回密码的,用了没反应,想起 来当时配置redmine的时候好像没去配置邮箱什么的,这个功能应该不好使。没办法,还是要用啊,只能网上去找重设密码的方法。

    先是找了一篇帖子http://blog.csdn.net/robinsonmhj/article/details/36876929?utm_source=tuicool

    但是我的环境和他的不太一样,进入ruby环境哪一步俺就不知道怎么弄,原谅俺不太会配置这些东西,安装redmine都是用的bitnami一键集成安装的...

    好吧废话不多说,俺的解决方法和前面的差不多,(1)就是先找redmine的数据库配置文件,(2)再安装数据库上的账号密码等等去连接数据库,(3)最后修改数据库里redmine的管理员密码。

    第一步,安装目录/redmin/apps/redmine/htdocs/config/database.yml,先找到这个,里面production有数据database,host,username,password,socket

    第二步,根据上面信息连接数据库,原谅我mysql也学的不好,废了好大力终于连接上了,

    第三步,找到用户表,修改密码,表是找到了,密码字段一看hashed_password.老大一串字符串,肯定是加过密的。还好官方文档给出了解释:http://www.redmine.org/projects/redmine/wiki/FAQ

    

Reset password lost without admin redmine account but with admin redmine database account

Found in file /app/models/user.rb: 'The hashed password is stored in the following form: SHA1\(salt +SHA1)'
So you can reset password in two steps:
- clear salt
- calculate sha1(sha1(new_password))
For example for the password "password" (without quote) it will be "353e8061f2befecb6818ba0c034c632fb0bcae1b"
sah1(password)=0bd181063899c9239016320b50d3e896693a96df
sha1(0bd181063899c9239016320b50d3e896693a96df)=353e8061f2befecb6818ba0c034c632fb0bcae1b

You have to go to redmine database, find "users" table, find user to reset password, clear "salt" field's user and put "353e8061f2befecb6818ba0c034c632fb0bcae1b" in "hashed_password" field's user and log to redmine with new password 'password' (without quote). To do this redmine database changes, do the following from command line in the operating system where Redmine is working:

  • note user and password from a file config/database.yml.
  • For MySQL
    • execute command:mysql -u <db user from database.yml> -p
    • enter: <password from database.yml>
    • execute:UPDATE users SET hashed_password='353e8061f2befecb6818ba0c034c632fb0bcae1b' WHERE login='admin';
    • execute:UPDATE users SET salt='' WHERE login='admin';
    • execute:exit

Now you can go to Redmine login web page to login as user admin with 'password' as password.

上面大概的意思就是 hashed_password 设置成 353e8061f2befecb6818ba0c034c632fb0bcae1b ,另外把salt 清空,密码就成了 password.

设置完之后终于有密码能够登陆了,长舒一口气......

声明

  欢迎转载,但请保留文章原始出处:)

  http://log.motnahp.com/post/2015/8/7/20278.html

 

posted on 2015-08-12 10:26  镇天  阅读(5999)  评论(1编辑  收藏  举报