js333 > 计算机互联网 > Denied的解决办法

原标题:Denied的解决办法

浏览次数:177 时间:2019-11-07

管理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了。  

卸载了tomcat6 for Linux,原因是其目录下没有找到  webapps/  

 Tomcat的配置

<?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

这是Ubuntu内自带的,导致问题不能即使解决!

  Tomcat的主要配置文件有3个,分别是:
    Tomcat-users.xml、
    web.xml
    server.xml。

     

下载tomcat-7.0.11 for Linux_ubuntu_debian)

配置Tomcat-users.xml

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

下载在Linux公社的1号FTP服务器里,下载地址:

  该文件包含了所有Tomcat服务器的注册用户,其中有role(角色)、user(用户)两种信息。
      下面列举出这个XML文件的全部内容。 

 <!--
  <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"/>

FTP地址:ftp://www.linuxidc.com

 

</tomcat-users>

用户名:www.linuxidc.com

<?xml version='1.0' encoding='utf-8'?>

相关阅读:

密码:www.muu.cc

<!--

Linux下Apache与多个Tomcat 集群负载均衡 http://www.linuxidc.com/Linux/2012-01/51731.htm

在 2011年LinuxIDC.com3月Linux下Tomcat-7.0.11中tomcat-users.xml配置

  Licensed to the Apache Software Foundation (ASF) under one or more

Nginx Tomcat 集群负载均衡解决笔记 http://www.linuxidc.com/Linux/2013-07/86827.htm

下载方法见

  contributor license agreements.  See the NOTICE file distributed with

实例详解Tomcat组件安装+Nginx反向代理Tomcat+Apache使用mod_jk和mod_proxy反向代理和负载均衡 http://www.linuxidc.com/Linux/2013-06/85290.htm

直接解压文件,即可看见,不要命令的那么麻烦!

  this work for additional information regarding copyright ownership.

Apache+Tomcat 环境搭建(JK部署过程) http://www.linuxidc.com/Linux/2012-11/74474.htm

此时文件下看到了:

  The ASF licenses this file to You under the Apache License, Version 2.0

深入剖析Tomcat PDF http://www.linuxidc.com/Linux/2013-11/92595.htm

图片 1

  (the "License"); you may not use this file except in compliance with

Tomcat 的详细介绍:请点这里
Tomcat 的下载地址:请点这里

<--如果没有这些文件 只能说明,和tomcat6一样 是缺省的下载文件-->

  the License.  You may obtain a copy of the License at

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-04/100856.htm

进入  conf/  配置 tomcat-users.xml  we

        以上是apache版本许可协议(感谢apache提供开源软件)

图片 2

图片 3

     

 加入:

 

<tomcat-users>
     <role rolename="tomcat"/> 
     <role rolename="role1"/> 
     <role rolename="manager"/> 
     <role rolename="admin"/> 
     <role rolename="admin-gui"/> 
     <role rolename="admin-script"/> 
     <role rolename="manager-gui"/> 
     <role rolename="manager-script"/> 
     <role rolename="manager-jmx"/> 
     <role rolename="manager-status"/>  
     <user username="admin" password="network" roles="admin,manager,role1,tomcat,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" /> 

  Unless required by applicable law or agreed to in writing, software

 

  distributed under the License is distributed on an "AS IS" BASIS,

</tomcat-users>

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

附上我的文件配置:

  See the License for the specific language governing permissions and

<?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

  limitations under the License.许可证的一些信息

     

-->

  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="tomcat"/> 
     <role rolename="role1"/> 
     <role rolename="manager"/> 
     <role rolename="admin"/> 
     <role rolename="admin-gui"/> 
     <role rolename="admin-script"/> 
     <role rolename="manager-gui"/> 
     <role rolename="manager-script"/> 
     <role rolename="manager-jmx"/> 
     <role rolename="manager-status"/>  
     <user username="admin" password="network" roles="admin,manager,role1,tomcat,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" /> 

 

</tomcat-users>

配置部分

 

<tomcat-users>

原因是:tomcat-7.0.11 对用户的登录要求比tomcat5 &&  6要严格!

<!--

启动  bin/start.sh

  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.


-->

操作系统:Linux_Ubuntu10.10_debian

<!--

Apache服务器:Tomcat-7.0.11

  NOTE:  The sample user and role entries below are wrapped in a comment

图片 4

  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="tomcat"/>  

<role rolename="role1"/>  

<role rolename="manager"/>  

<role rolename="admin"/>  

<role rolename="admin-gui"/>  

<role rolename="admin-script"/>  

<role rolename="manager-gui"/>  

<role rolename="manager-script"/>  

<role rolename="manager-jmx"/>  

<role rolename="manager-status"/>  

 <user username="admin" password="network" roles="admin,manager,role1,tomcat,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" /> 

</tomcat-users>

 

 

本文由js333发布于计算机互联网,转载请注明出处:Denied的解决办法

关键词:

上一篇:邮件发送已经说烂了的功能,Core中MailKit无法使用

下一篇:没有了