How to fix Tomcat WARNING: An attempt was made to authenticate the locked user?

*爱你&永不变心* 提交于 2019-11-28 11:53:46

The warning above means that you fail to authenticate the user tomcat more than once. Tomcat suspects that it is brute force attack on the user tomcat.

What authentication you use in your application? What login-config you use in web.xml of the application?

The default configuration of resourceName "UserDatabase" is the file conf/tomcat-users.xml. Did you change the configuration of resourceName "UserDatabase"?

You can find the configuration of the resource UserDatabase in the file server.xml:

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

By default all users are commented. To be able to work with users from the XML file you should uncomment. Then, you will be able to login with user tomcat:

<tomcat-users>
  <role rolename="tomcat"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
</tomcat-users>

Best regards,

Michael

(To the 16k visitors to this page:

Since this is on SO, I'll assume readers are developers.)

This error indicates that you have a script / user trying to login with an incorrect user/pass. Fixing this is simple, simply add the correct user/pass pair to the file ApacheTomcat\conf\tomcat-users.xml and restart the server.

Also ensure that you have the role properly set. E.g. if you're sending basic HTTP auth requests to localhost:8080/manager, you'll need the manager-gui role:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager-gui"/>
  <user username="foobar" password="foobar" roles="tomcat,role1, manager-gui "/>
</tomcat-users>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!