geoffwilliams@home:~$

How to reset nexus admin password in Nexus 3 OSS

Nexus users are defined in an H2 database - not to be confused with OrientDB which isn’t used any more.

To reset a password, you need to connect to the database and run some SQL.

Sonatype have a comprehensive support article on how to do this: https://support.sonatype.com/hc/en-us/articles/213467158-How-to-reset-a-forgotten-admin-password-in-Sonatype-Nexus-Repository-3

But there are a couple of tweaks if your running Nexus in a container:

  1. Port 1234 can just be exposed permanently
  2. If access to H2 is needed, enable it in nexus.properties, which is usually found inside the container at /nexus-data/etc/nexus.properties, mounted to volume /nexus-data
  3. No external PostgreSQL in open source nexus: H2 is the only option
  4. You need a browser to access H2 console. If your Nexus is headless, you can expose port 1234 locally with an SSH tunnel:
ssh -L 1234:atlas.lan.asio:1234 atlas.lan.asio

This should be enough infrastructure to bring up a H2 console at http://localhost:1234 so you can follow the notes under Reset Admin User using H2 or PostgreSQL Database to reset the password to admin123.

After changing password, disable the H2 database and restart Nexus.

Next time be more careful 😉

Post comment

Markdown is allowed, HTML is not. All comments are moderated.