How to reset the admin password in AEM 6.3
Learn how to reset the admin password in AEM 6.3. You must stop AEM first.
Description :headding-anchor:description
Environment
Adobe Experience Manager 6.4, 6.5
Issue/Symptoms
The admin password is forgotten and needs to be reset.
Resolution :headding-anchor:resolution
Follow these steps to reset the password:
- 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 these steps:
java -jar oak-run-*.jar console path/to/crx-quickstart/repository/segmentstore --read-write ":load admin-reset.groovy"
- Enter the following:
:load admin-reset63.groovy
- 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}
- Start AEM.
Additional information
Needed Items:
- oak-run jar
admin-reset.groovy
script (download/remove .txt or create from content)
DOWNLOAD
admin-reset.groovy
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."
);
}