很多时候我们启动了tomcat进入了tomcat管理页面,我们可以点击tomcat manager查看我们部署好的项目,这时就会出现问题了,密码忘记了或者说想破解密码。狠命的输密码是不可取的,遇到这种问题可以这么来解决,这个方法非常好使。
1.打开tomcat的conf目录,找到tomcat-users.xml
2.打开这个文件。找到下面的几句 [html] view plaincopyprint?
- <tomcat-users>
- <!--
- NOTE: The sample user and role entries below are wrapped in a comment
- and thus are ignored when reading this file. Do not forget to remove
- <!.. ..> that surrounds them.
- -->
- <!--
- <role rolename="tomcat"/>
- <role rolename="role1"/>
- <user username="tomcat" password="tomcat" roles="tomcat"/>
- <user username="both" password="tomcat" roles="tomcat,role1"/>
- <user username="role1" password="tomcat" roles="role1"/>
- -->
- </tomcat-users>
把这段代码修改一下就OK了,可以照着下面的进行修改
[html] view plaincopyprint?
- <tomcat-users>
- <role rolename="manager"/>
- <role rolename="tomcat"/>
- <role rolename="admin"/>
- <role rolename="role1"/>
- <user username="tomcat" password="tomcat" roles="tomcat"/>
- <user username="both" password="tomcat" roles="tomcat,role1"/>
- <user username="admin" password="admin" roles="admin,manager"/>
- <user username="role1" password="tomcat" roles="role1"/>
- </tomcat-users>
密码要改成什么可以自己去设置,这样子应该就可以登录tomca了。
|