为什么忽略tomcat-users.xml?

时间:2016-05-27 22:54:14

标签: tomee

Windows 7 TomEE-plume 1.7.4(本地) Fedora 23 TomEE-Plume 1.7.4(远程) Firefox 46

http://localhost:8080 http://192.168.0.100(在Fedora 23上远程)

Apache Tomcat(TomEE)/7.0.68(1.7.4)页面在本地和远程实例上都可以正常运行。

我已经完成了尽职调查,阅读了TomEE文档和互联网搜索 在本地Windows实例上,单击以下任何按钮时,浏览器将直接转到该页面。但是在TomEE的远程实例上按下相同的按钮会弹出一个小的登录对话框。 tomcat-users.xml文件中只有一个用户标识。使用用户标识和密码时,拒绝访问。据我所知,用于运行TomEE-plume的Fedora id应配置为“nologin”。

问题1)我说的是,用于运行TomEE-plume的Fedora id应该配置为“nologin”。 问题2)为什么tomcat-users.xml中的id不起作用?

<?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"/>
-->
  <!-- Activate those lines to get access to TomEE GUI -->
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-status"/>
  <role rolename="manager-jmx"/>
  <user username="tomee" password="mypassword" roles="manager-gui,manager-script,manager-status,manager-jmx" />
</tomcat-users>

1 个答案:

答案 0 :(得分:0)

在这里重复你已经知道的答案,这样一来,这个问题就没有答案了。无需选择此作为正确答案。

tomcat-users.xml确实只在启动时读取,您必须退回JVM才能获取更改。如果您希望能够动态添加/删除用户,或者在不重新启动JVM的情况下更改其角色,请考虑使用LDAP支持的安全存储库。您可以通过此处的说明执行此操作:https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JNDIRealm