Main Tutorials

What is Tomcat default administrator password ?

Is there or what is the default administrator user and password for Tomcat?

Tested :

  1. Tomcat 8.0.30
  2. Tomcat 7.0.67
  3. Tomcat 6.0.44

Article update history

  1. Updated 03/02/2016 : Add support for Tomcat 7 and 8.
  2. Updated 08/04/2011 : Update article.

1. Tomcat 7 and Tomcat 8

Tomcat users are defined in the file – $TOMCAT_HOME/conf/tomcat-users.xml, by default, there is NO user, it means no one can access the Tomcat manager page.

To enable users to access the Tomcat manager page, add a user as the role manager-gui.

$TOMCAT_HOME/conf/tomcat-users.xml (Original)

<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"/>
-->
</tomcat-users>
$TOMCAT_HOME/conf/tomcat-users.xml (Updated)

<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="admin" password="admin" roles="manager-gui"/>

</tomcat-users>

Saved it and restart Tomcat, now you should able to access the default manager page (http://localhost:8080/manager) with user = “admin” and password = “admin”

Note
Please refer to this official Tomcat Manager App HOW-TO

2. Tomcat 6

For Tomcat 6, add a user as the role manager

$TOMCAT_HOME/conf/tomcat-users.xml (Updated)

<tomcat-users>

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

</tomcat-users>
Note
This “manager” role is deprecated, and removed since Tomcat 7.

References

  1. Tomcat Manager App HOW-TO
  2. Maven – deploy web application to Tomcat

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
82 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
robert
10 years ago

mkyong thanx for a wonderful help, here is the one i tried.

Open in notepad, and just erase everything you have in tomcat-users.xml file and paste these lines.

 
<?xml version='1.0' encoding='cp1252'?>
<tomcat-users>
  <role rolename="manager-gui"/>
  <user username="tomcat" password="s3cret" roles="manager-gui"/>
</tomcat-users>

 

hope it will work 🙂

Joan
2 years ago
Reply to  robert

It worked!

Marvin
3 years ago
Reply to  robert

It worked

ikshita
4 years ago
Reply to  robert

robert thank you, finally this worked for me.

Luis
6 years ago

this helped me, thanks.

sreekumar
8 years ago

it worked for me,thanks

sanjeeev kumar
6 years ago

thanku very much

esmaeill
6 years ago

thank you

Vaibhav Reddy
7 years ago

Thanks it helped 🙂

Jaskirat Bamrah
8 years ago

As after above code I was still note able to get my Application Manager/ App manager Then Change the role

so, can also set this code as (this below code worked for me)

manager-gui — Access to the HTML interface.

manager-status — Access to the “Server Status” page only.

manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the “Server Status” page.

manager-jmx — Access to JMX proxy interface and to the “Server Status” page.

mkyong
8 years ago

Thanks, fixed and updated.

Roberto Góes
9 years ago

Thanks!

renaissance
9 years ago

thanks for the info

ABC
4 years ago

this helped me thanks a lot

HARSH
4 years ago

Hello, I’m using tomcat 7 can anybody tell will it for work if I use the above method if not then what I can do to gain access as in the NOTE box it’s mentioned that manager role is deprecated.

shilpa
4 years ago

i installed tomcat .when i open the tomcat-users.xml in command prompt i entered role rolename =”manager-gui” and below lines as you mentioned .then i saved file and closed it . when i go to manager webapp in browser it ask password and username , i entered the both by tomcat-users.xml file.but it doesn’t go to manager app , i get asked to enter password and username again and again

Harish
4 years ago

what a simple and nice tutorial

Aaron Peterson
5 years ago

Do we need to restart tomcat to have it read the config file?

Aaron Peterson
5 years ago
Reply to  Aaron Peterson

sudo service tomcat8 restart

Bandham Manikanta
5 years ago

ThnQQQ

Scott
5 years ago

If you are trying to edit the xml content and it says you don’t have access because you aren’t and administrator, try opening the tomcat-users.xml like usual except run your text editor as an administrator

Ahmad Wijaya
5 years ago

thanks

vikaks
6 years ago

When i save then is give a message Access denied means unable to save……what to do tell me

Bar
6 years ago

hmm not posting
role rolename=”manager-gui”
role rolename=”admin-gui”
user username=”admin” password=”admin” roles=”admin-gui, manager-gui”

Bar
6 years ago

Hi
still struggling with it. spend few days on internet but still no luck
is there a way to troubleshoot?
my OS
Windows
my Tomcat is:
Apache Tomcat/8.0.14
my tomcat-users.xml:

in my context.xml locking to local host is commented out
in my server.xml following uncommented
<Resource name="UserDatabase" auth="Container"
.
and
<Realm className="org.apache.catalina.realm.LockOutRealm"
.
by one of suggestions created
D:Tomcat80_4confCatalinalocalhostmanager.xml

still getting 401

appreciate any suggestion

Regards

Bar
6 years ago
Reply to  Bar

missed to post users xml

Miguel
6 years ago

MIchisimas gracias

Bor
6 years ago

Thanks a lot!!!!!!

Agus Cardeilhac
7 years ago

Hi !. I am writing you from Córdoba, Argentina. I am placing the same Xml Content in the tomcat-users file and I am still being rejected and get a 401 invalid credentials or unauthorized… I am under tomcat 7… Is there any other thing to configure in order to get into the manager console and deploy an app ?.
Thankx

Angel Rodrigues
5 years ago

Did you restart the server after adding the new users?

Harsh
8 years ago

add a role manager-gui to the list.

CYRIL YOHANNAN
9 years ago

I installed tomcat in my Virtual Private Server in godaddy. Now I tried to access to Tomcat Host Manager using url: http://myServerIP:8080
But I dont know the username and password for the same. How to get the username and password to login to host manager? Is there any default password.? Please help. I’m in real trouble.

srikanth parimi
9 years ago

As you said I added few users that’s working fine but up to how many maximum users i can add for tomcat manager to log in.

zoyeb
10 years ago

<!–

–>

note:replace the entire text except this (note) USERNAME:tomcat PASSWORD:s3cret

Skender Kollcaku
8 years ago
Reply to  zoyeb

Hi,
My name is Skender Kollcaku.
here is the xml I saved with the Vi editor under Debian:

<!–

–>

Hope it helps you!
Sk

Bipin Kumar
7 years ago

it worked – Thanks . the key is will not work – will work

silverxmay
7 years ago

this worked for me too

Muza Izama
8 years ago

it work… thanks so mch,,,,,,

Sergio
8 years ago

It works, thanks!

Anshul Sood
10 years ago

Thank you Mkyong!

Ali
10 years ago

Thank You mkyong.

mehdi
10 years ago

thinks a lot for all your tips, but i still have a problem
———————————————————-

403 Access Denied

You are not authorized to view this page.

If you have already configured the 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 Manager application. You will need to reset this protection by returning to the main Manager page. Once you return to this page, you will be able to continue using the 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 manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above.

nadim
10 years ago
Reply to  mehdi

when i am updating xml file. it show an error message, telling that access to tomcat-user.xml was denied. pls tell, why it is happening?

blumonkey
8 years ago
Reply to  nadim

Did you use sudo to edit the file?