Friday 26 November 2010

Apache Archiva admin account locked

(Archiva 1.1.3 with default Derby database)

Many times I have had this problem. It's time to note the solution here, so I would not waste any time in the future. I just forgot the admin password or locked it some way.
Here is a step by step solution:


  • Download and install some database client for Derby (I have SQuirreL SQL Client 3.2.0).
  • Create new account on Archiva's Web interface, and remember the password.
  • Stop Archiva on server.
  • Locate users database folder on the server (I have it in /usr/share/apache-archiva/data/databases/users/), make a backup and download it to your local machine, and then remove the content of this folder on server.
  • Connect to the database with your client (in SQuirreL, I'm using Apache Derby Embedded driver and jdbc:derby:C:/derby_home/databases/users/ as URL with user name sa).
    If you get an error Error occured in IPlugin.sessionStarted() for Hibernate Plugin within SQuirreL, just ignore (close) it.
  • Find table JDOUSER within SA schema and open its content for editing (in SQuirreL: right click on content and then click Make Editable).
  • Set values for all or just for admin account:
    • COUNT_FAILED_LOGIN_ATTEMPTS = 0
    • ENCODED_PASSWORD - copy the encoded password value from the account created in the second step
    • LOCKED = N
    • PASSWORD_CHANGE_REQUIRED = N
    • PERMANENT = Y
    • VALIDATED = Y
  • Close the database session.
  • Copy all files from local database folder to server's database folder.
  • Run the Apache Archiva and log in as admin with password that you set for the new account in the step 2 of this guide.

8 comments:

Anonymous said...

Saved my day.
Thank you!
--Gustavo

Anonymous said...

Thank you, thank you, thank you! This worked perfectly.

--Connie

Jubz said...

Good one! This was getting on my nerves, accounts always locked out.

Anonymous said...

Worked well. Thanks

Mourad said...

thx !!!!!!!!

Anonymous said...

Great post!
I had a problem that there was no SMTP server configured, so user creation was failing; thus password copying technique did not work.

But installation was pretty fresh, so w/o any damage I have deleted users database (at /$archiva_home$/data/databases/users) and after Archiva restart it asked to reenter admin password again.

TODO:
* Stop Archiva
* Backup users database
* Delete /$archiva_home$/data/databases/users dir
* Start Archiva
* Go to Archiva home page
* Enter new admin password
* Enjoy!

All credits goes to http://mail-archives.apache.org/mod_mbox/archiva-users/200901.mbox/%3C806d3a1f0901160849g527fe891p8010f7a8bab47f2d@mail.gmail.com%3E

CA Development said...

Thank you very much for the great explanation!!

I already tried to add the following security settings to the file "security.properties"

security.policy.password.expiration.days=999999
security.policy.password.expiration.enabled=false
security.policy.allowed.login.attempt=300
security.policy.password.previous.count=1
security.policy.password.rule.reuse.enabled=false

but without success so far (I have no idea what's the problem).
But your proposal worked well!!

Unknown said...

Thank you. This article helped to resolve the issue for me

Popular Posts