- Apache Tomcat installed and configured on your server.
-
Locate
tomcat-users.xml
file: This file is typically located in theconf
directory of your Tomcat installation. -
Edit
tomcat-users.xml
: Open thetomcat-users.xml
file in a text editor. -
Define Users: Within the
<tomcat-users>
element, define users using the<user>
element. For example:<tomcat-users> <user username="admin" password="adminpassword" roles="manager-gui,admin-gui"/> <user username="deployer" password="deployerpassword" roles="manager-script"/> <!-- Additional users and roles can be defined here --> </tomcat-users>
-
Define Roles: Roles define the permissions granted to users. Tomcat provides several built-in roles (
manager-gui
,manager-script
,admin-gui
, etc.). You can also define custom roles. -
Access Tomcat Management Interfaces: Depending on the roles assigned to users, they will have access to different Tomcat web applications:
manager-gui
: Grants access to the Tomcat Manager web application.manager-script
: Grants access to the text-based interface for managing Tomcat using scripting.admin-gui
: Grants access to the Host Manager web application.
-
Secure Configuration File: Ensure that the
tomcat-users.xml
file is properly secured, as it contains sensitive information such as user passwords. -
Restart Tomcat: After making changes to the
tomcat-users.xml
file, restart the Tomcat server for the changes to take effect.