udeleng
udeleng

Reputation: 866

Can't access Tomcat 6 Manager app

I keep getting prompted for a user name and password when I try to access the following URL:

http://localhost:8080/manager/html

App Server: Tomcat 6.0.35

Browser: Firefox 3.6.18

OS: Centos 5.5

Content of tomcat-users.xml:

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

I started Tomcat with: sudo ./startup.sh

I stopped Tomcat with: sudo ./shutdown.sh

Upvotes: 6

Views: 48148

Answers (5)

Robert White
Robert White

Reputation: 711

I had this problem last night and the problem (after making sure the user was created with correct manager-gui role) turned out to be that I was trying to access localhost and there was a RemoteAddrValve in the web app Context file (manager.xml) only allowing access to the manager web app via 127.0.0.1. Yes, localhost resolves to 127.0.0.1, but the valve is very precise.

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1" />

Upvotes: 0

kwutchak
kwutchak

Reputation: 1022

If you still have issues after setting up tomcat-users.xml, check that this file is being referenced in the standard way from server.xml. Both <GlobalNamingResources> and <Realm> need to be defined.

I pulled the following from a fresh install of Tomcat:

<Server port="8005" shutdown="SHUTDOWN">
 :
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  :
  <Service name="Catalina">
    :
    <Engine name="Catalina" defaultHost="localhost">
      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      :
    </Engine>
  </Service>
</Server>

Upvotes: 1

Picrochole
Picrochole

Reputation: 155

Don' forget to check if your admin application exists in %tomcat_dir%/webapps. If not, you can download it again with the tomcat distribution

Upvotes: 0

Alex Nevsky
Alex Nevsky

Reputation: 900

The roles have changed with Apache Tomcat 6 as per the link to the documentation below. http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Configuring_Manager_Application_Access

There are four roles defined by the manager application:

manager-gui - Allows access to the html interface
manager-script - Allows access to the plain text interface
manager-jmx - Allows access to the JMX proxy interface
manager-status - Allows access to the read-only status pages

For your problem, try this:

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

Login with user and password.

It works 100%.

Upvotes: 18

Rajesh
Rajesh

Reputation: 1

Update Tomcat-HOME/conf/tomcat-users.xml:

<tomcat-users>
<role rolename="manager"/>
<role rolename="standard"/>
<role rolename="tomcat"/>
<role rolename="admin"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="admin" password="password" roles="standard,manager,admin"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>

In ubuntu::

  • Start tomcat: sh startup.sh
  • Stop tomcat: sh shutdown.sh

Upvotes: 0

Related Questions