Artifactory: How to unlock the "admin" account that is locked out of Artifactory without restarting Artifactory service
BackgroundAs an Artifactory administrator, sometimes, when we continuously enter the wrong password, the "admin" account will be locked.
If you have another user who has admin permission, you can refer to ARTIFACTORY: What should I do if my users get locked out of Artifactory? and ARTIFACTORY: How To Unlock A User(s) Who Is Locked Out Of Artifactory and Recover Admin Account to unlock the "admin" account. If you don't have any other admin users, you can create a new admin user to unlock the "admin" account, which also refers to the above articles. But both of them Need to Restart Artifactory.
If you have only one admin user and you don't want to restart Artifactory due to being in a product environment and cannot be restarted at this time (there is a heavy request load), you can unlock it in the database. Here are the steps:
Step 1Check if the status of the "admin" account in the table access_users is "locked", by executing the following SQL:
mysql> select * from access_users where username = 'admin' ;
Response:
*************************** 1. row *************************** user_id: 2 username: admin password: argon$$argon2id$v=19$m=512,t=16,p=1$9K1tshvtkeryOKoX4TwvUA$IwNtmDr9jB6eEsJlFVleo7jqNuP9sM3/8so9/TDAUTQ allowed_ips: 127.0.0.1 created: 1703213390936 modified: 1703214162212 firstname: NULL lastname: NULL email: test@test.com realm: internal status: locked last_login_time: 1703213881971 last_login_ip: 52.215.237.185 failed_attempts: 0 status_last_modified: 1703214162212 password_last_modified: 1703213427386 1 row in set (0.00 sec)
Step 2If the status is “locked”, update the status column to "enabled" for the “admin” account:
mysql> update access_users set status='enabled' where username = 'admin';
Response:
Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0
No need to restart Artifactory. Now, you can log in Artifactory using the admin account again.
Recommendations:
Artifactory What Should I Do If My Users Got Locked Out Of Artifactory
How To Unlock A User(s) Who Is Locked Out Of Artifactory and Recover Admin Account