Additional menu

Unable to Access Tomcat Manager 6, 7, 8  and 9

Unable to Access Tomcat Manager 6, 7, 8 and 9

Geek Flare Blog post is sponsored by Netsparker Web Application Security Scanner.

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.

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

  • Go to Tomcat installation and then webapps/manager/META-INF
  • 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:

  • 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.

Reader Interactions

Chandan Kumar
About Chandan
Chandan Kumar is the founder of Geek Flare. Learn more here and connect with him on Twitter.

Comments

  1. Hi guys, i still get always the same 401 error.
    Im using Tomcat 8.0.36, my system is with el capitan OS X, i also download idk-8u9-macosx-x64, and to edit the file I’m using editrochet.
    please someone can help me?

Leave a Reply

Your email address will not be published. Required fields are marked *

21 Shares
Share
Tweet
Stumble
Share