配置Tomcat6的管理用户

简介:

在Tomcat上发布war之前需要配置一个管理用户以进入上传页面,而配置就是通过修改/usr/local/tomcat6/conf/tomcat-users.xml这个文件进行的。下面是修改后的文字:

复制代码
<?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"/>
  <role rolename="manager"/>
  <user username="president" password="123" roles="manager"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>
复制代码

上面的

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

这两句是新加入的,这两句就把管理用户配置上了。其它部分无需修改。

另外一点需要注意的是,有时

    <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <user username="president" password="123" roles="manager"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

这一整段都被上面的<!-- 和下面的 -->包围着,致使中间的内容被屏蔽而不起作用,这在VI编辑器中不容易发现,需要人为多注意一下。

修改好tomcat-users.xml文件后,重启tomcat就能进去上传war的页面了。












本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/xiandedanteng/p/5232411.html,如需转载请自行联系原作者


相关文章
|
应用服务中间件 Apache
tomcat6-7配置管理用户
tomcat6:          tomcat7:     但是Tomcat7的 上面是不对的哦,亲;
703 0
|
应用服务中间件 数据安全/隐私保护 数据格式
tomcat 初始管理用户和密码
tomcat 安装完成后,或者是binary版本的,当启动tomcat服务,登陆到管理界面的时候,会让你输入用户名和密码。但是我们不知道是什么,这时就需要查\tomcat6\conf文件夹下有个tomcat-users.
629 0
|
1月前
|
XML 应用服务中间件 Apache
Tomcat AJP连接器配置secretRequired=“true“,但是属性secret确实空或者空字符串,这样的组合是无效的。
Tomcat AJP连接器配置secretRequired=“true“,但是属性secret确实空或者空字符串,这样的组合是无效的。
|
4月前
|
Java 应用服务中间件 Maven
Maven - 两种Tomcat插件的配置
Maven - 两种Tomcat插件的配置
127 0
|
10天前
|
前端开发 Java 应用服务中间件
Springboot对MVC、tomcat扩展配置
Springboot对MVC、tomcat扩展配置
|
4月前
|
Java 应用服务中间件 容器
SpringBoot配置外部Tomcat并打war包
SpringBoot配置外部Tomcat并打war包
68 0
|
3天前
|
运维 Java 应用服务中间件
Tomcat详解(七)——Tomcat使用https配置实战
Tomcat详解(七)——Tomcat使用https配置实战
12 4
|
4月前
|
Java 应用服务中间件
SpringBoot 项目war包部署 配置外置tomcat方法
SpringBoot 项目war包部署 配置外置tomcat方法
70 0
|
18天前
|
Java 应用服务中间件
Springboot启动的时候初始化的线程池默认配置tomcat
Springboot启动的时候初始化的线程池默认配置tomcat
12 1
|
3月前
|
应用服务中间件 Windows
Tomcat安装和配置
Tomcat安装和配置
32 0