lujun
lujun

Reputation: 23

what's username/password of tomcat basic authentication?

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?

Upvotes: 2

Views: 12704

Answers (3)

Suman
Suman

Reputation: 482

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>

Upvotes: 2

DarthVader
DarthVader

Reputation: 98

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

Upvotes: 3

k-deux
k-deux

Reputation: 493

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?

Upvotes: 3

Related Questions