Tomcat Tip

When you first install Tomcat, there doesn’t seem to be any account configured with admin rights. This keeps the default install secure, but of course the first thing you’re going to want to do is log in to your new installation with admin rights.

To grant the tomcat user admin rights, edit conf/tomcat-users.xml. It starts out looking like this:

1
2
3
4
5
6
7
8
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="role1" password="tomcat" roles="role1"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>

Edit it to add the admin and manager roles to the tomcat user:

1
2
3
4
5
6
7
8
9
10
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="tomcat" password="tomcat" roles="tomcat,admin,manager"/>
  <user username="role1" password="tomcat" roles="role1"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>

If you use exactly this, you could then log in as username tomcat, password tomcat. But do yourself a favour and use a real password.