Sometimes, you may need to reset the admin password for Apache Archiva running inside a Docker container. This guide walks you through the process while ensuring your data is safe.
Why You Might Need to Reset the Admin Password
There are several scenarios where resetting the Archiva admin password becomes necessary:
- Forgotten Password – The admin password has been lost or forgotten, preventing access to the web interface.
- Security Breach – Suspected or confirmed unauthorized access requires updating the credentials immediately.
- User Handover – When a new administrator takes over management responsibilities.
- Misconfigured or Corrupted Users Database – Issues in the user database prevent login, necessitating a reset.
- Testing or Development – Resetting credentials during testing or development environments to ensure smooth access.
Prerequisites
- Ensure the Archiva container’s data directory is mounted so you don’t lose any data.
- Backup any critical data before proceeding.
When Archiva runs in Docker, you need to access the container shell to perform administrative tasks.
1. List Running Containers
First, identify your Archiva container name or ID:
docker ps
2. Access the Container Shell
Use the docker exec
command to access your container. Replace archiva-container
with your container name:
docker exec -it containerID /bin/bash
If your container does not support bash
, use sh
:
docker exec -it containerID /bin/sh
Resetting Apache Archiva Admin Password
Resetting the admin password involves deleting the current users' database so Archiva can recreate it, prompting a new admin setup.
Steps
1. Stop the Archiva Container
To avoid data loss, stop the container:
docker stop containerID
2. Backup and Delete the Users Database
Locate the mounted data directory inside your container (the default path is /home/archiva/current/data/databases
). Then, rename the users
database to keep a backup:
mv /path/to/mounted/data/databases/users /path/to/mounted/data/databases/users_backup
Make sure you’re operating on the mounted directory so your changes persist outside the container.
3. Restart the Archiva Container
Start the container again:
docker start containerID
Archiva will detect the missing users database and recreate it.
4. Create a New Admin User
Access the Archiva web interface:
http://<archiva-server-host>:<port>
Follow the prompts to set up a new admin user.
Summary
By stopping the container, backing up the user database, and restarting, you can safely reset your Archiva admin password without losing your repository data.
Top comments (0)