Ubuntu – How to access tomcat manager gui from another machine

tomcatUbuntuweb-server

I have tomcat 8 setup on ubuntu 16.04 on a remote server. I want to access the gui manager app from my local machine. Visiting the page /manager/html, I get a 403 access denied page with the following info:

By default the Host Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Host Manager's context.xml file.

and it says to add the following to this file:

/conf/tomcat-users.xml

<role rolename="manager-gui"/>
<user username="username" password="password" roles="manager-gui"/>

I've done that, restarted tomcat:

sudo systemctl restart tomcat

but I get the same error page.

Any idea what I'm missing?

Thanks

Best Answer

For Tomcat v8.5.4 and above, the file <tomcat>/webapps/manager/META-INF/context.xml has been adjusted:

<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" />
</Context>

Change this file to comment the Valve:

<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" />
    -->
</Context>

After that, refresh your browser (not need to restart Tomcat), you can see the manager page.