Reset Admin credentials

Dear team,

I’ve been testing a local installation of keycloak a long time ago. Now that I want to login back into the admin console I’m unable to do so. It looks like I forgot the username/password.

Is there a way for me to reset the admin/password to a default one, by using for example the CLI or some tool running on the server?

Thank you for your help.

Hi,

Yes you can do it using the CLI using the add-user-keycloak.sh script as follows:
sudo -u keycloak ./bin/add-user-keycloak.sh --user YourUser --password YourNewPass --realm YourRealm
You will add a user and you can later remove the old user.

1 Like

hi Team

When im trying above command it was failing and getting below output

root@ip-192-168-23-158:/opt/keycloak/bin# sudo -u ubuntu ./add-user-keycloak.sh --user admin --password Starlet@2hjhjk --realm Dev
No content to map due to end-of-input
at [Source: (FileInputStream); line: 1, column: 0]

please be kind enough to check what is missing out there

Thanks in advance