简体   繁体   English

Apache Tomcat配置:访问未经授权

[英]Apache Tomcat configuration: Access not authorized

I am using Apache Tomcat server. 我正在使用Apache Tomcat服务器。 I installed successfully on my computer because the server in running but My problem is that I cannot open a page due wrong credential. 我成功在计算机上安装了该服务器,因为服务器正在运行,但是我的问题是由于凭据错误而无法打开页面。 Below is the message after I enter my credential as username: root and password: tomcat 以下是我输入用户名作为凭据后的消息: root和密码: tomcat

Access to Tomcat server has not been authorized. Set the correct username 
and password with the "manager-script" role in the Tomcat customizer in the 
Server Manager.
See the server log for details.

What do I have do to do solve this issue or what is wrong? 我该怎么做才能解决此问题或出了什么问题?

This can be resolve by changing/ammending the below entry in your tomcat directory, in file \\conf\\tomcat-users.xml 可以通过更改/扩展tomcat目录中的以下条目来解决此问题,该目录位于\\ conf \\ tomcat-users.xml文件中

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

Hope this will resolve your issue 希望这能解决您的问题

In Windows operating system, Call %CATALINA_HOME% is directory what Apache Tomcat installed. 在Windows操作系统中,呼叫%CATALINA_HOME%是Apache Tomcat安装的目录。 (In Unix, macOS, $CATALINA_HOME is the home directory of Apache Tomcat) (在Unix中,macOS中, $CATALINA_HOME是Apache Tomcat的主目录)

Looking for file %CATALINE_HOME%\\conf\\tomcat-users.xml . 寻找档案%CATALINE_HOME%\\conf\\tomcat-users.xml Declare user and corresponding role follow instructor 声明用户和相应角色跟随指导者

<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>

This is an example, it just work 这是一个例子,就可以了

<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user username="admin" password="admin" roles="manager-gui,manager-status,manager-script,manager-jmx"/>
<user username="admin2" password="admin2" roles="manager-gui,manager-status"/>
<user username="admin3" password="<must-be-changed>" roles="manager-jmx"/>

You need restart Apache Tomcat for new configuration in affected. 您需要重新启动Apache Tomcat才能进行受影响的新配置。

Reference: https://tomcat.apache.org/tomcat-8.0-doc/manager-howto.html#Configuring_Manager_Application_Access 参考: https : //tomcat.apache.org/tomcat-8.0-doc/manager-howto.html#Configuring_Manager_Application_Access

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

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