Tomcat的Manager显示403 Access Denied

Tomcat的Manager显示403 Access Denied

大家好,又见面了,我是全栈君。

管理tomcat的时候遇到了以下问题:

  1.刚开始需要用户名密码,不知道用户名和密码是什么,但是输入什么都不正确。

  解决办法:

  自己在tomcat-users.xml中按格式添加用户 conf文件夹里面

  默认是注释掉了的,这主要是考虑到服务器的安全,如果是本地测试,去掉以下这段注释,然后重启动服务器,再输入

   <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″/>

  用户和密码都一目了然了。

2.进入manager界面之后,显示的是403 Access Denied。

  解决办法:

  在conf/tomcat-users.xml文件中看到这么一段话:

  NOTE:  By default, no user is included in the “manager-gui” role required

    to operate the “/manager/html” web application.  If you wish to use this app,

    you must define such a user – the username and password are arbitrary.

  也就是说,为了考虑安全,tomcat默认还是没有manager-gui的管理权限的,如果想要使用manager

  的话,需要自行加入管理权限(角色)。

  需要加一个这样的权限(角色)

  <role rolename=”manager-gui”/>

  然后再加到需要的用户名中去

  <user username=”tomcat” password=”tomcat” roles=”tomcat,manager-gui”/>

  这样OK了。

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not 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"/>
-->
    <role rolename="manager-gui"/>
    <role rolename="admin-gui"/>
    <user username="ming" password="064417" roles="manager-gui,admin-gui"/>

</tomcat-users>

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/108470.html原文链接:https://javaforall.net

(0)
上一篇 2022年3月3日 下午5:00
下一篇 2022年3月3日 下午5:00


相关推荐

  • not apng file怎么解决_function

    not apng file怎么解决_functionpadStartisnotafunction问题描述微信小程序开发时,控制台padStartisnotafunction;解决方案不用这个方法了呗,或者自己重新在String.prototype.padStart中自己实现,毕竟是es6之后的方法,经测试,微信6.6.6版本不支持,6.6.10版本支持,和版本也有一定的关系,期望以后的支持性…

    2025年10月13日
    7
  • OpenClaw 3.13 更新了哪些内容?一文看懂这次版本升级重点

    OpenClaw 3.13 更新了哪些内容?一文看懂这次版本升级重点

    2026年3月15日
    3
  • 全球首款,百度红手指Operator上线 手机AI Agent实操指南

    全球首款,百度红手指Operator上线 手机AI Agent实操指南

    2026年3月14日
    1
  • vue对于ntko的应用经验

    vue对于ntko的应用经验本来生活过的美滋滋 突然告知要用 ntko 写一个操作 word 文档的界面 看到后立马提起兴致看了下 ntko 的基本文档 安装 ntko 研究小 demo 研究完后心里立刻妈卖批了 这个 ntko 居然限制游览器与 word 版本 可把我研究苦了 chrome45 后就限制了插件入口 firfox 跟 chrome 差不多 所以只能用一些特定的进行开发 1 开发环境选择使用的是 IE11 word2016 游览器与

    2026年3月19日
    3
  • 基于JavaWEB的在线电子书商城

    基于JavaWEB的在线电子书商城开发环境 Jdk7 8 Tomcat7 8 Mysql IntelliJIDEA Eclipse 数据库 MySQL 技术 Spring Springmvc Mybatis Bootstrap Jquery 适用于 课程设计 毕业设计 学习等等系统介绍 电子商务是指整个商务活动和贸易活动的电子化 它通过先进的信息网络 将事物活动和贸易活动中发生关系的各方有机地联系起来 电子商务网站实际上就是销售企业为消费者提供的网上购物商城 在该网站中用户可以购买任何商品 而管理员可以对商品和订单等信

    2026年3月26日
    2
  • MyBatis 所有的 jdbcType类型

    MyBatis 所有的 jdbcType类型MyBatis处理MySQL字段类型date与datetime1)DATETIME显示格式:yyyy-MM-ddHH:mm:ss时间范围:[‘1000-01-0100:00:00’到’9999-12-3123:59:59’]2)DATE显示格式:yyyy-MM-dd时间范围:[‘1000-01-01’到’9999-12-31’]3)TIMESTAMP显示格式:yyyy-MM-ddHH:mm:ss时间范围:[‘1970-01-0100:00:00’到’2037-12-

    2022年10月20日
    7

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号