Thursday, February 12, 2009

Hudson - forget password, reset password

I am avid Hudson user and have used it since it first released. It is a pretty cute CI server. I really love it and am very satisfied with using it. Thanks for saving me from the CruiseControl hell.

Today, I got a problem with Hudson because I forget my password. I think Hudson can send me my password, like many portals do. But with the version 1.226 I used, this feature is just missing. It’s okay, hope it is only “not yet implemented” :-). Then I begin googling and find a dangerous solution from the Hudson dashboard: Help! I locked myself out!

The drawback of this solution is that the Hudson is totally unprotected while the <useSecurity> is set to be false. Well, actually, if you use the “Hudson’s own user database” and “Matrix-based security” authorization setting, there are two better ways for the admin to solving this problem.

The first one: edit the authorization setting in the config.xml file if you have defined more users in your Hudson and you at least one user’s password. For example, your user name called peter and you know the password of the user jack, in this case, just open the %HUDON_HOME%/config.xml and find the line:


And add a new line below:


Save your change and restart your Hudson server, then you can login as jack and change your own password. After then login using your own account and go to http://<your>/hudson/configure and change jack back to his normal authorization setting.

The other way ist just editing your own config.xml, in this case, open %HUDON_HOME%/<your>/config.xml and find the line:


The text between the password tag is encoded, so you can’t just enter your password as plain text here. The easy way for you now is just remove all the text between that tag, in another word, just let the password empty.

Save your change and restart the Hudson sever, now you can login yourself without password. Please don’t forget to set your password. You can do it by clicking people -><you> -> configure, or (if you are admin) Manage Hudson -> Manage Users -> then edit the appropriate user account.

The second solution can also be used by the admin for reset the password of normal users.