码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat提示警告: An attempt was made to authenticate the locked user"tomcat"

时间:2016-05-04 10:31:20      阅读:1648      评论:0      收藏:0      [点我收藏+]

标签:

启动tomcat7之后,运行正常,但是运行一段时间就会提示以下警告:

十二月 04, 2013 5:10:15 下午 org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "tomcat"

虽然不影响程序的运行,但是后台控制台一直提示,所以上网搜索找出现这个现象的原因。 

处理这个问题最有效的办法是把tomcat的webappsx下,自带的文件夹全删除之后,问题解决。 

也可以按一下方法解决: 
原因: 
   由于tomcat-users.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="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
 <user username="zhuo" password="zhuo" roles="manager-gui,manager-script,manager-jmx,manager-status"/>

我把空行前半部分给注释掉了。 

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

解决办法如下: 
  把空行注释掉的配置放开后,如上的警告消失。

 原因介绍

你的应用加了身份认证,有人(或者你自己,呵呵)试图用manager用户登陆你的应用,密码输入错误5次或者5次以上(缺省是5次),就会在日志中记录警告信息,并锁定并禁止该用户的进一步登陆。以提醒你可能有人恶意猜测你的管理员密码。是tomcat为了阻止brute-force攻击(基于密码加密的暴力破解法)的安全策略。 

 配图技术分享

登陆用户名和密码在conf/tomcat-users.xml中配置 

server.xml中的配置如下: 

<!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>


<GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

 

tomcat提示警告: An attempt was made to authenticate the locked user"tomcat"

标签:

原文地址:http://www.cnblogs.com/hwaggLee/p/5457262.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!