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


相关推荐

  • webstorm好用的插件_谷歌浏览器插件推荐

    webstorm好用的插件_谷歌浏览器插件推荐安装插件codeglance可以实现VSCode的右侧小地图

    2025年10月10日
    3
  • svn中文语言包安装(最详细步骤)*

    svn中文语言包安装(最详细步骤)*标题 svn 中文语言包安装 最详细步骤 一 查看自己的 SVN 版本 这里省略也可以 同事 1 9 版本的直接在官网下载的语言包也能用 区别对待把 可以先直接在官网下载 不行再去找对应版本语言包 1 打开 SVN 找到关于 最后一个 英文的是 About 我这里是 1 12 2 版本如果跟我一样的 可以直接点击下载 SVN1 12 2 中文语言包也可以复制链接网页直接打开

    2026年3月20日
    4
  • matlab模糊控制工具箱使用教程_模糊pid控制原理

    matlab模糊控制工具箱使用教程_模糊pid控制原理Matlab模糊控制工具箱为模糊控制器的设计提供了一种非常便捷的途径,通过它我们不需要进行复杂的模糊化、模糊推理及反模糊化运算,只需要设定相应参数,就可以很快得到我们所需要的控制器,而且修改也非常方便。下面将根据模糊控制器设计步骤,一步步利用Matlab工具箱设计模糊控制器。1、模糊控制工具箱使用首先我们在Matlab的命令窗口(commandwindow)中输入fuzzy,回车就会出来…

    2022年8月30日
    4
  • intellijidea激活码2021(JetBrains全家桶)[通俗易懂]

    (intellijidea激活码2021)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.htmlTR0LFTT656-eyJsaWNlbnNlSWQi…

    2022年3月22日
    121
  • MacOS VSCode快捷键[通俗易懂]

    MacOS VSCode快捷键[通俗易懂]Macos下VSCode快捷键文章转载出处:http://www.cnblogs.com/informatics/全局Command+Shift+P/F1显示命令面板Command+P快速打开Command+Shift+N打开新窗口Command+W关闭窗口基本Command+X剪切(未选中文本的情况下,剪切光标所在行)Command+C复制(未选中文本的情况下,复制光标所在行)Option+Up向上移动行Option+D

    2022年6月4日
    152
  • 使用IntelliJ IDEA 配置Maven(入门)「建议收藏」

    使用IntelliJ IDEA 配置Maven(入门)「建议收藏」1.下载Maven官方地址:http://maven.apache.org/download.cgi解压并新建一个本地仓库文件夹2.配置本地仓库路径3.配置maven环境变量4.在IntelliJIDEA中配置maven打开-File-Settings5.新建mavenWEB项目打开-File-New-Project点击NEXT

    2022年5月28日
    59

发表回复

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

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