欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

登陆远程服务器的Tomcat 8的manger的页面 solr apachesolr 403 登录用户名 密码 有大用 有大大用

访问远程服务器Tomcat 8的管理页面报错

在远程服务器上安装了一个tomcat8.5,配置好用户后重新启动tomcat ,发现:8080可以访问,但是进入:8080/manager/html页面报403访问受限,具体报错信息如下:

403 Access Denied

You are not authorized to view this page.

By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file.

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 application'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.

网上搜了很多,但都不可行,最后在stack overflow上看到正解,所以记录保存下,修改
/webapps/manager/META-INF/context.xml文件,将文件中对访问的来源受限设置注释:

<Context antiResourceLocking="false" privileged="true" >
  <!--注释这里,去除对访问权限的设置
    <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
         -->
</Context>

然后直接刷新页面就行了,无需重启tomcat。

Stack Overfow问题链接地址:http://stackoverflow.com/questions/36703856/access-tomcat-manager-app-from-different-host?rq=1

来自  https://blog.csdn.net/chf1142152101/article/details/62042769



下面关于用户名密码设置的部分可以看一看


403访问被拒绝

您无权查看此页面。

默认情况下,只能从与 Tomcat 运行在同一台机器上的浏览器访问管理器。如果您希望修改此限制,则需要编辑 Manager 的context.xml文件。

如果您已经将 Manager 应用程序配置为允许访问,并且您使用了浏览器的后退按钮、保存的书签或类似的东西,那么您可能触发了为 HTML 启用的跨站点请求伪造 (CSRF) 保护Manager 应用程序的界面。您将需要通过返回主管理器页面来重置此保护 返回此页面后,您将能够继续正常使用管理器应用程序的 HTML 界面。如果您继续看到此访问被拒绝消息,请检查您是否具有访问此应用程序所需的权限。

如果您没有更改任何配置文件,请检查您安装中的文件 conf/tomcat-users.xml该文件必须包含凭据才能让您使用此 web 应用程序。

例如,要将manager-gui角色添加到名为 tomcat且密码为s3cret 的用户,请将以下内容添加到上面列出的配置文件中。

<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>

请注意,从 Tomcat 7 开始,使用管理器应用程序所需的角色已从单一管理器角色更改为以下四个角色。您需要为您希望访问的功能分配所需的角色。

  • manager-gui - 允许访问 HTML GUI 和状态页面

  • manager-script - 允许访问文本界面和状态页面

  • manager-jmx - 允许访问 JMX 代理和状态页面

  • manager-status - 只允许访问状态页面

HTML 接口受 CSRF 保护,但文本和 JMX 接口不受保护。要维护 CSRF 保护:

  • 不应授予具有manager-gui角色的用户manager-scriptmanager-jmx角色。

  • 如果 text 或 jmx 接口是通过浏览器访问的(例如用于测试,因为这些接口是为工具而非人类设计的),那么浏览器必须随后关闭以终止会话。

有关更多信息 - 请参阅 Manager App How-To




访问tomcat的manager提示403

ou are not authorized to view this page.


By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file.


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 application'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.

image.png




找到你当前的tomcat目录,进入webapps/manager/META-INF目录,可以看到 context.xml 这个文件,进去注释掉

image.png




然后再去tomcat下的conf目录里,修改 tomcat-users.xml 按照,报错的提示添加相应的权限就行了

image.png



我这里就根据自己需要配置的

image.png




往復不息

关注


————————————————

版权声明:本文为CSDN博主「往復不息」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

来自:https://blog.csdn.net/wifi74262580/article/details/81743725



普通分类: