Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Tomcat Last updated: September 6, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Necessary configuration to log in to Tomcat Manager

Tomcat manager is essential for administrative tasks. However, by default, it’s not functional.

There are few things you must do for tomcat manager to work.

Let’s see how…

As a best practice – take a backup of configuration file before modification so you can roll-back when something goes wrong.

Tomcat 6.x/7.x

  • Login to Tomcat server
  • Go to installation directory and then conf folder
  • Open the tomcat-users.xml and add the following above </tomcat-users> syntax
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>

Note: change the password from tomcat to something complex.

  • Restart Tomcat and try to log in

It should be successful.

Tomcat 8.x/9.x

By default, Tomcat 8 manager is configured to be accessed from the same server where it’s installed. If you access manager, you will get 403 error.

tomcat8-403

For a manager to be accessible from any host/IP, you need to do the following.

  • Go to Tomcat installation and then <span class="s1">webapps/manager/META-INF</span>
  • Open context.xml and comment Valve section as below
<Context antiResourceLocking="false" privileged="true" >
<!--
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127.d+.d+.d+|::1|0:0:0:0:0:0:0:1" />
-->
  <Manager sessionAttributeValueClassNameFilter="java.lang.(?:Boolean|Integer|Long|Number|String)|org.apache.catalina.filters.CsrfPreventionFilter$LruCache(?:$1)?|java.util.(?:Linked)?HashMap"/>
</Context>

Ex:

tomcat-context

  • Save the file
  • Next, go to conf folder and open tomcat-users.xml to adding the following above </tomcat-users> syntax
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>
  • Save the configuration file and restart the Tomcat

Login should be ok now. I hope this helps.

If you are new to Apache Tomcat or interested in learning more about administration, then I would recommend this online course.

  • Chandan Kumar
    Author
    As the founder of Geekflare, I’ve helped millions to excel in the digital realm. Passionate about technology, I’m on a mission to explore the world and amplify growth for professionals and businesses alike.
Thanks to our Sponsors
More great readings on Tomcat
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Monday.com is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder