Tomcat users are defined in the file $TOMCAT_HOME/conf/tomcat-users.xml
, by default, there is NO user, it means no one can access the Tomcat manager page.
To enable users to access the Tomcat manager page, add a user as the role manager-gui
.
Step 0. Shutdown Tomcat if it is running. Stop Java process as well, just to be safe.
Step 1. Open tomcat-users.xml file, originally it should contain a commented out part for tomcat-users.
<tomcat-users>
<!--
<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>
Step 2. Replace everything between <tomcat-users>
and </tomcat-users>
with the following:
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
Now your file should look like this:
<tomcat-users>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
</tomcat-users>
Step 3. Save the file and restart Tomcat, now you should able to access the default manager page (http://localhost:8080/manager) with user = “admin” and password = “admin”
If everything goes well, you should see the shiny Tomcat manager interface and deploy web applications (war file) pretty easily.