人老了記憶力差,一些長時間沒登陸過的賬號就想不起密碼。於是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