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

启动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>

 

转载于:https://www.cnblogs.com/hwaggLee/p/5457262.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值