You will definitely see the following error messages when you try to access the Host Manager (http://localhost:8080/host-manager/html) after installing the Apache Tomcat 7. If you want to access this page, please see the solution below.

403 Access Denied

You are not authorized to view this page.

If you have already configured the Host Manager application to allow access
and you have used your browsers back button, used a saved book-mark or
similar then you may have triggered the cross-site request forgery (CSRF)
protection that has been enabled for the HTML interface of the Host Manager
application. You will need to reset this protection by returning to the
main Host Manager page.
Once you return to this page, you will be able to continue using the Host
Manager appliction’s HTML interface normally. If you continue to see this
access denied message, check that you have the necessary permissions to
access this application.

If you have not changed
any configuration files, please examine the file
conf/tomcat-users.xml in your installation. That
file must contain the credentials to let you use this webapp.

For example, to add the admin-gui role to a user named
tomcat with a password of s3cret, add the following to the
config file listed above.

<role rolename="admin-gui"/>
<user username="tomcat" password="s3cret" roles="admin-gui"/>

Note that for Tomcat 7 onwards, the roles required to use the host manager
application were changed from the single admin role to the
following two roles. You will need to assign the role(s) required for
the functionality you wish to access.

  • admin-gui – allows access to the HTML GUI
  • admin-script – allows access to the text interface

The HTML interface is protected against CSRF but the text interface is not.
To maintain the CSRF protection:

  • Users with the admin-gui role should not be granted the
    admin-script role.
  • If the text interface is accessed through a browser (e.g. for testing
    since this interface is intended for tools not humans) then the browser
    must be closed afterwards to terminate the session.

In order to access the Host-Manager, we have to make an admin-gui role. Include the following code in \Tomcat 7.0\conf\tomcat-users.xml

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

Just change the username and password. Restart the Tomcat 7 Web Server Service and your problem is now solved! :)

Oh by the way, you might not able to access the Manager App and Server Status using admin account. To access this, you must add a role in the roles attribute  roles=”admin-gui, manager-gui”.

Hope this information helps. A simple “Thank you” in the comments section is very much appreciated. :)

Is this post helpful? If it does, please help me to publish quality articles like this. Send some TIPS to keep this website alive by clicking the paypal button or sending Bitcoins to BTC address below:
Click the QR Code or text above to copy the BTC Address.

OR better if you could support this website by buying my book (This is available both on paperback and e-book version)! A true Green Stickman avid reader would definitely have this one. Limited copies only for the paperback! So make sure to grab your copy.