Expand my Community achievements bar.

How do i reset default admin the password, which has been set via command prompt

Avatar

Level 5
Level 5

I have set up an admin password via command prompt as shown in the AEM documentation, but unfortunately i have forgot the password of the admin, is there any way to recover the admin password.?

1281107_pastedImage_0.png

Thanks,

VAr

4 Replies

Avatar

Administrator

Please have a look at this post:-Changing User Passwords in AEM 6.1 via cURL | 6D Labs

// It covers Changing User Passwords in AEM 6.1 via cURL

If you know the user's path then try, curl -u admin:admin -F rep:password="aem6dev" -F:currentPassword="admin" http://<<<CUT>>>:4502/home/users/a/admin.rw.html

Source:- #AEM #CURL Change Admin Password · GitHub

~kautuk



Kautuk Sahni

Avatar

Level 5
Level 5

Thanks Kautuk,

but unfortunate is i don't remember the exact node path of admin user as AEM creates the user node with random node some thing like  example " /home/users/H/H7K-n3ZqABjdb0Wesk0w". Is there any other way to reset the password.?

VAr

Avatar

Administrator

Did you chek Changing User Passwords in AEM 6.1 via cURL | 6D Labs ?

//

1. call the Query Builder via cURL to get the path to the user:

    curl -s -u admin:admin -X GET "http://localhost:4502/bin/querybuilder.json?path=/home/users&1_property=rep:authorizableId&1_propert...{USER_NAME}&p.limit=-1" > user.json

2. Read the path from the JSON result:

USER_PATH=`ruby -rjson -e 'j = JSON.parse(File.read("user.json")); puts j["hits"][0]["path"]'`

3. USER_PATH variable can be used to set the user's password:

curl -s -u admin:admin -Fplain={NEW_PASSWORD} -Fverify={NEW_PASSWORD}  -Fold={OLD_PASSWORD} -FPath=$USER_PATH http://localhost:4502/crx/explorer/ui/setpassword.jsp

Putting it all together, if I wanted to change the admin user's password I would call:

curl -s -u admin:admin -X GET "http://localhost:4502/bin/querybuilder.json?path=/home/users&1_property=rep:authorizableId&1_propert..." > user.json

USER_PATH=`ruby -rjson -e 'j = JSON.parse(File.read("user.json")); puts j["hits"][0]["path"]'`

curl -s -u admin:admin -Fplain=admin1 -Fverify=admin1  -Fold=admin -FPath=$USER_PATH http://localhost:4502/crx/explorer/ui/setpassword.jsp

~kautuk



Kautuk Sahni

Avatar

Level 5
Level 5

If i forgot the admin password, will the below curl query works.? where as in  curl -s -u admin:admin -X admin:admin is the admin user name and password.