Unable to view server status, application manager page in Tomcat: does not accept username and password, why is this so?

I can’t see the server status and App Manager page in Tomcat.

enter image description here

Although I configured the username and password in tomcat-users.xml , it does not accept the combination and displays this message:

 401 Unauthorized You are not authorized to view this page. 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 manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above. <role rolename="manager-gui"/> <user username="tomcat" password="s3cret" roles="manager-gui"/> Note that for Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access. manager-gui - allows access to the HTML GUI and the status pages manager-script - allows access to the text interface and the status pages manager-jmx - allows access to the JMX proxy and the status pages manager-status - allows access to the status pages only The HTML interface is protected against CSRF but the text and JMX interfaces are not. To maintain the CSRF protection: Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles. If the text or jmx interfaces are accessed through a browser (eg for testing since these interfaces are intended for tools not humans) then the browser must be closed afterwards to terminate the session. 

I edited tomcat-users.xml as:

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

I set the username and password as suhail . Why doesn't he accept the combination?

+4
source share
6 answers

I started the Tomcat server from my IDE (Netbeans). So, I had to change the configuration from the Netbeans settings:

enter image description here

Now it works as expected!

0
source

I also fought a lot. This one worked for me. Copy to the folder below tomcat-users.xml

 <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> --> <role rolename="manager-gui" /> <user username="jeril" password="1" roles="manager-gui"/> </tomcat-users> 
+5
source

add the line below to your tomcat-users.xml file to check server status and manager application.

 <user username="username" password="password" roles="admin-gui,manager-gui"/> 
+2
source

copy the paste below the lines in your tomcat-user.xml and change the username and password

  <?xml version='1.0'?> <tomcat-users> <user name="username" password="password" roles="admin-gui,manager-gui" /> </tomcat-users> 

restart tomcat

0
source

This worked for me ... you just need to keep an eye on when you configure your user roles. Some user roles cannot use the same username.

For instance:

Users with the manager-gui role should not be given the manager-script or manager-jmx roles. If text or jmx interfaces are accessed through a browser (for example, for testing, since these interfaces are intended for tools, not for people), then the browser should then be closed to end the session.

Users with the administrator role should not be granted the admin-script role. If the text interface is accessed through a browser (for example, for testing, since this interface is intended for tools, not for people), the browser must then be closed to end the session.

So, this is what I did, and I was able to view all three states of the server, application manager, host manager

Hope this helps you.

 <tomcat-users> <role rolename="admin-gui"/> <role rolename="manager-gui" /> <user username="Your User Name" password="Your Password" roles="manager-gui, admin-gui"/> </tomcat-users> 

Make sure you turn off tomcat and restart it again.

0
source

FYI: I encountered the same error 401 (in Tomcat 7), but was based on a completely different problem related to copying and pasting tomcat-users.xml definitions from the Internet. There are two types of double quotes (for example, different Unicode characters) that look almost the same, and so I missed this problem for hours!

One type of double quotation mark (the one that works) is the direct type "(Unicode character U + 0022), the other (which does not work) is the curved or curly or italic or" right "type" (Unicode character U + 201D).

My login worked flawlessly after replacing the wrong double quotes with the correct ones.

The key that made me find this problem was to look at catalina.out, which reports the following error (Note: in my tomcat-users.xml file, I deleted all comments to make sure I was dealing with simple XML- instructions for isolation problem):

 SEVERE: Parse Fatal Error at line 4 column 18: Open quote is expected for attribute "{1}" associated with an element type "rolename". 

My login worked flawlessly after replacing the wrong quotes.

0
source

All Articles