10

I am using apache-archiva-2.2.0 version. I lost the admin password so I want to reset the password of admin user.

I tried to reset the password through remove the below mentioned files.

./apache-archiva-2.2.0/data/databases/users/dbex.lck

./apache-archiva-2.2.0/data/databases/users/db.lck

But still it's asking for password post restart the service.

Database details-

<New id="users" class="org.eclipse.jetty.plus.jndi.Resource">
  <Arg>jdbc/users</Arg>
  <Arg>
    <New class="org.apache.tomcat.jdbc.pool.DataSource">
      <Set name="driverClassName">org.apache.derby.jdbc.EmbeddedDriver</Set>
      <Set name="url">jdbc:derby:<SystemProperty name="appserver.base" default=".."/>/data/databases/users;create=true</Set>
      <Set name="username">sa</Set>
      <Set name="maxActive">20</Set>
      <Set name="removeAbandoned">true</Set>
      <Set name="logAbandoned">true</Set>
      <Set name="initialSize">5</Set>
      <Set name="testOnBorrow">true</Set>
      <Set name="validationQuery">select 1</Set>
    </New>
  </Arg>
</New>

Let me know how can I change the password?

jwvh
  • 50,871
  • 7
  • 38
  • 64
Anubhav Gupta
  • 115
  • 1
  • 1
  • 6
  • file names put in code format for readability, used a slightly more standard indentation – jwvh Mar 23 '17 at 03:59

3 Answers3

18

I've done this by stopping archiva, deleting the users database at data/databases/users, e.g.,

% pwd
/home/archiva/current/data/databases
% mv users{,.old}

and then starting archiva again.

Archiva will rebuild the users database and offer you the option to create a new admin user when it is back up.

If you'd like to disable password expiration entirely, follow the steps at https://serverfault.com/a/840545

A Lee
  • 7,828
  • 4
  • 35
  • 49
  • Thanks! Worked for me. – Stefan Höltker Sep 26 '17 at 10:01
  • Saved my Day, Thanks. Though, it was configured for not to expire, it still does and after expiry headache to do this back end thing. – Anand Oct 17 '17 at 06:42
  • Worked here also, but like Anand, I wonder how to ensure the password does not expire. It would be nice to be able to set and forget for an internal archive. – J E Carter II Dec 18 '17 at 14:55
  • 3
    When using the [xetusoss/archiva docker image](https://hub.docker.com/r/xetusoss/archiva) it is slightly different: 1. `mv /archiva-data/data/databases/users /archiva-data/data/databases/users_backup` 2. Restart Archiva by simply restarting the container or pod when in Kubernetes. – martn_st Sep 25 '20 at 08:59
10

it is working for me,

following steps,

1 . open /usr/local/apache-archiva-2.2.3/conf directory then open archiva.xml and change expiration like this

<expiration>
        <enabled>false</enabled>
   <days>90</days>
  </expiration>

then restart archiva

Abdulkerim Atik
  • 101
  • 1
  • 4
  • 2
    When using the [xetusoss/archiva docker image](https://hub.docker.com/r/xetusoss/archiva) the config lives in `/archiva-data/conf/archiva.xml` – martn_st Sep 25 '20 at 08:57
0

If you don't want to delete your whole users database, there is a very good guide here: http://kris-itproblems.blogspot.com/2010/11/apache-archiva-admin-account-locked.html In short: copy users database and modify it locally with database client for Derby like SQuirreL SQL, then copy it back and restart Archiva.

Artur Łysik
  • 407
  • 1
  • 9
  • 14