Tuesday, March 6, 2012

How to change Admin password in CQ5.5

Use case Change admin password

Good news Till now you have to change admin password at multiple location if you are using CQ5.4, see here

From CQ5.5 onward you just have to change admin password once. There are multiple ways though,

1) Using CRX explorer (Old way)



2) Using granite http://host:port/libs/granite/security/content/admin.html#edit:/home/users/a/admin



3) using curl command

curl -u admin:OLD_PWD -F rep:password="NEW_PWD" http://host:port/home/users/a/admin.rw.html


You can also use security API for do user related task, Something like this

curl -d "createUser=true&authorizableId=$userId&rep:password=pw&membership=administrators" -u "admin:admin" http://host:port/libs/granite/security/post/authorizables

(There is set of operation you can do using this, JAVA DOC coming soon)


For any other user other than admin you can use CURL to change password as

curl rep:password="test" --user admin:ADMIN_PASSWORD http://host:port/home/users/a/aparker@geometrixx.com


You still have to use CURL command to change replication agent password mention here

For CQ5.6:

Above curl command does not work for CQ 5.6 instead use this command to change admin password


curl -u admin:<OLD PASSWORD> -Fplain=<NEW PASSWORD> -Fverify=<NEW PASSWORD>  -Fold=<OLD PASSWORD> -FPath=/home/users/a/admin http://HOST:PORT/crx/explorer/ui/setpassword.jsp

BELOW DOES NOT WORK IN CQ5.6 thats why have strike. Looking in to this.

You can also try http://sling.apache.org/documentation/bundles/managing-users-and-groups-jackrabbit-usermanager.html#change-password to change password of a USER. For that you first have to download http://mvnrepository.com/artifact/org.apache.sling/org.apache.sling.jcr.jackrabbit.usermanager/2.2.0 and then install it using felix console or through your code.

Note For all cases you need current admin password to perform operation. As always please test it before use.

Thanks Alex from Adobe for Helping.

7 comments:

  1. I have incorporated this information and other stuff I've found through experimenting into the change-cq5-passwords script in https://github.com/42Lines/cq5tools which works with both 5.4 and 5.5. Hopefully this script will save others time.

    ReplyDelete
  2. Jim,

    This looks great ... Thanks a lot for sharing ...

    ReplyDelete
  3. Jim do you have something for 5.6 release?

    ReplyDelete
    Replies
    1. Hello Jim,

      Same should work for CQ5.6 as well.

      Yogesh

      Delete
    2. it is hanging in this step:

      + curl -s --data rep:password=s3cr3t --user admin:s3cr3t http://localhost:4502/home/users/a/author
      + E=1
      + '[' 1 -ne 0 ']'

      thanks

      Delete
    3. Hello Roque,
      Did you try curl -u admin:OLD_PWD -F rep:password="NEW_PWD" http://host:port/home/users/a/admin.rw.html ?

      Yogesh

      Delete