简体   繁体   English

如何获取Tomcat的管理员用户和密码以访问Servlet列表

[英]how to get Tomcat's admin user and password to access Servlets list

when i access localhost tomcat, and click on "ManagerApp" this is what i get 当我访问localhost tomcat并单击“ ManagerApp”时,这就是我得到的

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.

<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>
Note that for Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access.

manager-gui - allows access to the HTML GUI and the status pages
manager-script - allows access to the text interface and the status pages
manager-jmx - allows access to the JMX proxy and the status pages
manager-status - allows access to the status pages only
The HTML interface is protected against CSRF but the text and JMX interfaces are not. To maintain the CSRF protection:

Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles.
If the text or jmx interfaces are accessed through a browser (e.g. for testing since these interfaces are intended for tools not humans) then the browser must be closed afterwards to terminate the session.
For more information - please see the Manager App HOW-TO.

So How do i fix this? 那么我该如何解决呢?

add

<user name="admin" password="admin" roles="admin-gui,manager-gui" />

to tomcat directory/conf/tomcat-users.xml inside <tomcat-users> tag and restart the tomcat service and login using this credentials to localhost:8080 or IP:8080 . <tomcat-users>标记内的tomcat directory/conf/tomcat-users.xml然后重新启动tomcat服务,并使用此凭据登录到localhost:8080IP:8080

You can change the username and password from tomcat-users.xml file. 您可以从tomcat-users.xml文件中更改用户名和密码。

when you visit localhost:8080 and when click on host-manager or other page then it will ask for user name and password then add above credentials . 当您访问localhost:8080并单击host-manager或其他页面时,它将要求输入用户名和密码,然后添加上述credentials

So then your above error will not occur. 因此,您的上述错误将不会发生。

this credentials you have to give at installation time of tomcat. 您必须在tomcat的安装时提供此凭据。

Still get problem post me. 还是给我发问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM