what's username/password of tomcat basic authentication?

12,360

Solution 1

Lujun

The file after update should look like this

<?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"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
</tomcat-users>

Restart tomcat and use admin/admin

Solution 2

depending on your tomcat version, this should work:

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

EDIT: and please read this ;-) What is the default username and password in Tomcat?

Solution 3

You need to change the file "tomcat-users.xml"

File path C:\Users\suman\Documents\Software\apache-tomcat-7.0.55\conf

File Name tomcat-users.xml

<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"/>
<role rolename="admin"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<role rolename="manager-script"/>
<role rolename="admin-script"/>
<user username="admin" password="admin" roles="admin,manager,manager-gui"/>
</tomcat-users>
Share:
12,360
Admin
Author by

Admin

Updated on June 13, 2022

Comments

  • Admin
    Admin almost 2 years

    I've digged the internet for the guide about how to set tomcat authentication,and yes,it really has a pop-up window,which allows me to input username/password,but it seems that my username/password is wrong. I add fraction of my tomcat-user.xml here:

    enter code here
    <!--
      <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"/>
    -->
    

    and fraction of web.xml here:

    enter code here
    <auth-constraint>
      <role-name>tomcat</role-name>
      <role-name>both</role-name>
      <role-name>role1</role-name>
    </auth-constraint>
    

    All these "tomcat/tomcat,both/tomcat,role1/tomcat" don't work. What's problem?