Many times we have started tomcat and entered the tomcat Management page. We can click tomcat manager to view the deployed project. In this case, a problem occurs, and the password is forgotten or we want to crack the password. It is not advisable to lose passwords. This solution can be used to solve such problems.
1. Open the conf directory of tomcat and find the tomcat-users.xml
2. open the file. Find the following sentence
<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>
Www.2cto.com
You can modify the code as follows.
<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>
You can set the password as needed. In this way, you can log on to tomca.
Author: chenwill3