How can I reset a forgotten admin password?

If you had the user's email address set properly (and the smtp configuration set properly), you could click login in the UI and select forgot password, enter the username and email address, and a new password will be sent to you. If you do not have email setup properly, you will need to manually edit the security.xml file, located in (nexus-basedir)/../sonatype-work/nexus/conf/security.xml.

  1. Stop Nexus
  2. Edit (nexus-basedir)/../sonatype-work/nexus/conf/security.xml
  3.  find the <user> object that has a <id> of admin
  4. change the <password> to
    f865b53623b121fd34ee5426c792e5c33af8c227
  5. Make sure the user has an active status: 

    <status>active</status>

  6. Save the file and start Nexus

This will give the admin user a password of admin123 (the default) and you will again be able to log in as admin user with the password admin123.

Note: The above applies to Nexus 2.4 and earlier. For nexus 2.5 and later the admin123 password hash is:

$shiro1$SHA-512$1024$G+rxqm4Qw5/J54twR6BrSQ==$2ZUS4aBHbGGZkNzLugcQqhea7uPOXhoY4kugop4r4oSAYlJTyJ9RyZYLuFBmNzDr16Ii1Q+O6Mn1QpyBA1QphA==

Note: In order for this to work the XML security realm must be installed.  It likely is, since it ships by default, but sometimes people remove it.  If you're still having trouble check "sonatype-work/nexus/conf/security-configuration.xml" and make sure the realms list has the following two lines:

  <realms>
    <realm>XmlAuthenticatingRealm</realm>
    <realm>XmlAuthorizingRealm</realm>
...
  </realms>
Have more questions? Submit a request

6 Comments

  • 0
    Avatar
    Bruce Wen

    This is very useful for us! Thanks!

  • 0
    Avatar
    wenzhu.chen

    Perfect,Thanks

  • 0
    Avatar
    sg

    How do i do this with Nexus 3.0 Milestone 7 release.

    don't see a security.xml anymore

  • 0
    Avatar
    Rich Seddon

    For now contact support for help with 3.0m7 and resetting the admin password.

  • 0
    Avatar
    sg

    thanks for the answer, i guess i can have it just re-installed instead for now.

  • 0
    Avatar
    Peter Lynch

    We are closing this article for comments.

    If you have a support license, please contact us by submitting a support ticket.

    If you do not have a support license, please use our Nexus Users List or our other free support resources.

Article is closed for comments.
Powered by Zendesk