Reset Management UI Local User Password¶
Use this procedure to reset the password of a local user (for example,
scality) when no administrator can log in to the management UI.
This procedure applies to local users only. The password of an LDAP user is managed in the LDAP directory.
The new password is temporary: the user must set a permanent password at the next login to the management UI.
Note
If an administrator can still log in to the management UI, use Configure a User Temporary Password instead.
Prerequisites¶
You can log in to a ARTESCA node as the
artesca-osuser.kubectl,jq, andcurlare installed.
Procedure¶
Note
Run all commands in the same shell session. Each step reuses the variables declared in the previous steps.
Retrieve the URL for the management UI.
[artesca-os@bootstrap ~]$URL=$(sudo salt-call metalk8s_network.get_control_plane_ingress_endpoint --out=json | jq -cr '.local')
Retrieve the Identity Provider administrator password.
[artesca-os@bootstrap ~]$KC_ADMIN_PASSWORD=$(sudo kubectl --kubeconfig=/etc/kubernetes/admin.conf \ get secret artesca-kc-initial-admin --namespace artesca-auth \ --output jsonpath='{.data.password}' | base64 -d)
Generate an administrator access token.
Note
Administrator access tokens expire after 60 seconds. The
get_admin_tokenfunction generates a new token for each command.[artesca-os@bootstrap ~]$get_admin_token() { curl -s -k "${URL}/auth/realms/master/protocol/openid-connect/token" \ -d "client_id=admin-cli" \ -d "username=admin" \ --data-urlencode "password=${KC_ADMIN_PASSWORD}" \ -d "grant_type=password" | \ jq -cr '.access_token' } get_admin_token
<administrator access token>
If the command returns
null, check theURLandKC_ADMIN_PASSWORDvalues.List the local users.
[artesca-os@bootstrap ~]$curl -s -k -H "Authorization: Bearer $(get_admin_token)" \ "${URL}/auth/admin/realms/artesca/users?max=1000" | \ jq -r '.[] | select(.federationLink == null) | [.username, (.email // "-"), .enabled] | @tsv' | column -t
scality change.me@scality.invalid true <username> <email> true
Declare the local user whose password you want to reset, replacing
<username>with a value from the first column of the previous output.[artesca-os@bootstrap ~]$KC_USER='<username>'
Retrieve the user ID.
[artesca-os@bootstrap ~]$USER_ID=$(curl -s -k -H "Authorization: Bearer $(get_admin_token)" \ -G "${URL}/auth/admin/realms/artesca/users" \ --data-urlencode "username=${KC_USER}" -d "exact=true" | \ jq -cr '.[0].id') echo ${USER_ID}
The command returns an ID such as
f475c5b1-75cf-4d93-bc49-7c3c14ecf608. If it returnsnull, check theKC_USERvalue.Enter the new temporary password. The password is not displayed.
[artesca-os@bootstrap ~]$read -r -s -p "New password: " NEW_PASSWORD; echo
Reset the password.
[artesca-os@bootstrap ~]$jq -n --arg pw "${NEW_PASSWORD}" '{type: "password", value: $pw, temporary: true}' | \ curl -s -k -w "\n%{http_code}\n" -X PUT \ -H "Authorization: Bearer $(get_admin_token)" \ -H "Content-Type: application/json" \ "${URL}/auth/admin/realms/artesca/users/${USER_ID}/reset-password" \ --data-binary @-
204
The command returns
204when the password is reset. If it returns another code, the response body above the code gives the reason. A400usually means the password does not meet the password policy: enter another password and run this step again.Clear the passwords from the shell session.
[artesca-os@bootstrap ~]$unset NEW_PASSWORD KC_ADMIN_PASSWORD
Log In With the New Password¶
Open your web browser and navigate to the management UI URL.
Log in with the local user name and the temporary password.
Update your password and click Submit.
You are logged in to the ARTESCA management UI with the new password.

