Objective

Admin password is forgotten and needs to be reset.

Environment

AEM 6.3, AEM6.4

Steps

  1. Enter the following command in the server command prompt (replace the path with the path to your AEM segmentstore

    java -jar oak-run-*.jar console path/to/crx-quickstart/repository/segmentstore --read-write :load admin-reset.groovy
    
  2. Oak-run should be launched in console mode, there should be a console with a leading /> to enter commands. If it does not work, then verify that the path to the segmentstore is correct.

  3. Enter the following:

    :load admin-reset63.groovy
  4. 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}
  5. Enter the following to exit console, stop the oak run jar before you can start AEM
    :q

  6. Start AEM

Additional information

Needed Items:

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

다운로드

import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook

class Global {
    static adminNode = null;
}

void findAdminNode(ub) {
    if (ub.hasProperty("rep:principalName")) {
        if ("rep:principalName = admin".equals(ub.getProperty("rep:principalName").toString())) {
            Global.adminNode = ub;
        }
    }
    ub.childNodeNames.each { it -> 
        if (Global.adminNode == null) {
            findAdminNode(ub.getChildNode(it));
        }
    }
}

ub = session.store.root.builder();
findAdminNode(ub.getChildNode("home").getChildNode("users"));

if (Global.adminNode) {
    println("Found admin node: " + Global.adminNode.toString());
    Global.adminNode.setProperty("rep:password", PasswordUtil.buildPasswordHash("admin"));
    session.store.merge(ub, EmptyHook.INSTANCE, CommitInfo.EMPTY);
} else {
    println("Could not find admin node.");
}

이 작업에는 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License의 라이센스가 부여되었습니다.  Twitter™ 및 Facebook 게시물은 Creative Commons 약관을 적용받지 않습니다.

법적 고지 사항   |   온라인 개인 정보 보호 정책