1.默认admin存放位置
admin用户信息默认存放在/root/.jenkins/users/admin/config.xml文件中。
[root@iZj6c7eeosj2t5vjw8rf4xZ admin]# cat config.xml
<?xml version='1.1' encoding='UTF-8'?>
<user>
<fullName>admin</fullName>
<properties>
<jenkins.security.ApiTokenProperty>
<apiToken>{AQAAABAAAAAwzaSuZnmlQZdTqpGR+OJFsLttgq85/TvpE+HdXnDorJ5CVEyLKBZwWU23KNK1BMbhp5XOOVjn938Z+Xbop3z9Pg==}</apiToken>
</jenkins.security.ApiTokenProperty>
<hudson.model.MyViewsProperty>
<views>
<hudson.model.AllView>
<owner class="hudson.model.MyViewsProperty" reference="../../.."/>
<name>all</name>
<filterExecutors>false</filterExecutors>
<filterQueue>false</filterQueue>
<properties class="hudson.model.View$PropertyList"/>
</hudson.model.AllView>
</views>
</hudson.model.MyViewsProperty>
<hudson.model.PaneStatusProperties>
<collapsed/>
</hudson.model.PaneStatusProperties>
<hudson.search.UserSearchProperty>
<insensitiveSearch>true</insensitiveSearch>
</hudson.search.UserSearchProperty>
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>#jbcrypt:$2a$10$MiIVR0rr/UhQBqT.bBq0QehTiQVqgNpUGyWW2nJObaVAM/2xSQdSq</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
<jenkins.security.LastGrantedAuthoritiesProperty>
<roles>
<string>authenticated</string>
</roles>
<timestamp>1528791323260</timestamp>
</jenkins.security.LastGrantedAuthoritiesProperty>
</properties>
</user>
查看config文件,可以发现有一个passwordHash节点,该节点对应的就是admin用户加密后的密码。
2.修改admin密码为123456
然后修改config文件的passwordHash节点对应的值改为#jbcrypt:2a2a10$MiIVR0rr/UhQBqT.bBq0QehTiQVqgNpUGyWW2nJObaVAM/2xSQdSq
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>#jbcrypt:$2a$10$MiIVR0rr/UhQBqT.bBq0QehTiQVqgNpUGyWW2nJObaVAM/2xSQdSq</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
这样admin用户的密码就变成123456了。
3.重启jenkins
因为笔者的jenkins是放在tomcat上面的,所以重启一下tomcat配置就生效了。然后重新用admin账号登录,密码123456就行了
---------------------
作者:Frankeen
版权声明:本文为博主原创文章,转载请附上博文链接!