How to modify the Tomcat username and password

Source: Internet
Author: User
Tags tomcat tomcat server


We can manage tomcat through the graphical user interface, start Tomcat, and enter in the Address bar:

http://localhost:8080

You can see the Tomcat Welcome page, and clicking on the Tomcat Manager on the left will show a dialog box that requires a username and password, and when you forget the username and password when you first installed Tomcat, we can resolve this by following Fangjie:


Modify the Tomcat-users.xml file, which opens the file in the Conf directory under Tomcat's installation directory, and we can see the following information:

<tomcat-users>
<!–
Note:by default, no user is included in the ' Manager-gui ' role required
To operate the "/manager/html" Web application. If you are wish to the use of this app,
You must define such a user-the username and password are.
–>
<!–
Note:the sample user and role entries below are wrapped in a comment
And thus are ignored when reading this file. Don't forget to remove
<!.. .. > that surrounds them.
–>
<!–
<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>
Here we add the following sentence:
<user username= "admin" password= "admin" roles= "Admin,manager"/>
The modified file is:
<tomcat-users>
<!–
Note:by default, no user is included in the ' Manager-gui ' role required
To operate the "/manager/html" Web application. If you are wish to the use of this app,
You must define such a user-the username and password are.
–>
<!–
Note:the sample user and role entries below are wrapped in a comment
And thus are ignored when reading this file. Don't forget to remove
<!.. .. > that surrounds them.
–>
<!–
<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″/>
–>
<user username= "admin" password= "admin" roles= "Admin,manager"/>
</tomcat-users>

Restart the Tomcat server, at which point we can log on to Tomcat's admin interface with user name admin, password Admin, so that we can remotely administer Tomcat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.