How to reset the admin password in AEM 6.3

Description

Admin password is forgotten and needs to be reset.


Environment


AEM 6.4,6.5

Resolution

Steps

  1. Enter the following command in the server command prompt (replace the path with the path to your AEM segmentstore).AEM should be stopped before running the steps below:

java -jar oak-run-*.jar console path/to/crx-quickstart/repository/segmentstore --read-write ":load admin-reset.groovy"

  1. Enter the following:
:load admin-reset63.groovy
  1. Press enter and the script will automatically find and change the admin password to admin.
    Review the output, it says:

    Found admin node : SegmentNodeBuilder{path=/home/users/some/path}
  2. Start AEM



Additional information


Needed Items:

  • oak-run jar
  • admin-reset.groovy script (download/remove .txt or create from content)

DOWNLOAD

Get file

admin-reset.groovy

  1. import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil
  2. import org.apache.jackrabbit.oak.spi.commit.CommitInfo
  3. import org.apache.jackrabbit.oak.spi.commit.EmptyHook
  4.  
  5. class Global {
  6.     static adminNode = null;
  7. }
  8.  
  9. void findAdminNode(ub) {
  10.     if (ub.hasProperty(“rep:principalName”)) {
  11.         if (“rep:principalName = admin”.equals(ub.getProperty(“rep:principalName”).toString())) {
  12.             Global.adminNode = ub;
  13.         }
  14.     }
  15.     ub.childNodeNames.each { it -
  16.         if (Global.adminNode == null) {
  17.             findAdminNode(ub.getChildNode(it));
  18.         }
  19.     }
  20. }
  21.  
  22. ub = session.store.root.builder();
  23. findAdminNode(ub.getChildNode(“home”).getChildNode(“users”));
  24.  
  25. if (Global.adminNode) {
  26.     println("Found admin node: " + Global.adminNode.toString());
  27.     Global.adminNode.setProperty(“rep:password”, PasswordUtil.buildPasswordHash(“admin”));
  28.     session.store.merge(ub, EmptyHook.INSTANCE, CommitInfo.EMPTY);
  29. else {
  30.     println(“Could not find admin node.”);
  31. }

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now