Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)
Expert Contributor

It's not a simple process, but one that can be easily done by anyone with a little database admin experience. You have to add a user by restarting cbd with new user and password in Profile. Then you go into the database and move the encrypted password from the new user to the old. This will change the password and leave your old user with access to the clusters and resource you've already built.

Overview

  1. Edit the Profile and change both the UAA_DEFAULT_USER_PW to the desired new password and UAA_DEFAULT_USER_EMAIL to a different address.
  2. cbd restart – This will add a 2nd user with the new password to the database
  3. docker exec -ti cbreak_commondb_1 bash – Starts a bash shell in the database container
  4. pg_dump -Fc -U postgres uaadb > uaadb.dump – Makes a backup of the user database
  5. psql -U postgres – Starts a postgres shell
  6. postgres=# \c uaadb; – Connects to the user database in the postgres shell
  7. uaadb=# select * from users; – Shows the two accounts and their encrypted passwords
  8. update users set password='$2a$10$nTd3OV33zfM/lfQTIPKN7OrxL4uCQqRotJXXERqDhzeVB9Dlfmlum' where email = 'admin@example.com'; - Sets the original user’s password to the new user’s password, which you copy from the select output.
  9. Log in with the new password and you’ll see everything is still in place.

Walk-through


postgres=# \l
                                  List of databases
    Name     |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges
-------------+----------+----------+------------+------------+-----------------------
cbdb        | postgres | UTF8     | en_US.utf8 | en_US.utf8 |
periscopedb | postgres | UTF8     | en_US.utf8 | en_US.utf8 |
postgres    | postgres | UTF8     | en_US.utf8 | en_US.utf8 |
template0   | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
             |          |          |            |            | postgres=CTc/postgres
template1   | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
             |          |          |            |            | postgres=CTc/postgres
uaadb       | postgres | UTF8     | en_US.utf8 | en_US.utf8 |
(6 rows)

postgres=# \c uaadb;
You are now connected to database "uaadb" as user "postgres".
uaadb=# \d
                 List of relations
Schema |          Name          | Type  |  Owner
--------+------------------------+-------+----------
public | authz_approvals        | table | postgres
public | authz_approvals_old    | table | postgres
public | expiring_code_store    | table | postgres
public | external_group_mapping | table | postgres
public | group_membership       | table | postgres
public | groups                 | table | postgres
public | identity_provider      | table | postgres
public | identity_zone          | table | postgres
public | oauth_client_details   | table | postgres
public | oauth_code             | table | postgres
public | revocable_tokens       | table | postgres
public | schema_version         | table | postgres
public | sec_audit              | table | postgres
public | service_provider       | table | postgres
public | users                  | table | postgres
(15 rows)

uaadb=# select * from users;
                  id                  |         created         |      lastmodified       | version |          username          |                           password                           |           email            | givenname | familyname | active | phonenumber | authorities | verified | origin | external_id | identity_zone_id | salt | passwd_lastmodified | legacy_verification_behavior
--------------------------------------+-------------------------+-------------------------+---------+----------------------------+--------------------------------------------------------------+----------------------------+-----------+------------+--------+-------------+-------------+----------+--------+-------------+------------------+------+---------------------+------------------------------
eb52fb6c-b588-4401-8ad4-97b0e04ffc23 | 2018-06-28 19:55:02.066 | 2018-06-28 19:55:02.066 |       0 | admin@example.com  | $2a$10$TFGoKcaWNs7XWsO4AqvmlOHVe9yBSUcmtvo9tdLsf3AhL2oNUYOHW | admin@example.com  | Joe       | Admin      | t      |             | uaa.user    | t        | uaa    |             | uaa              |      | 2018-06-28 19:55:02 | f

2731b250-7de0-4f88-ae34-0fbd33206c42 | 2018-07-13 16:33:52.737 | 2018-07-13 16:33:52.737 |       0 | admin2@example.com | $2a$10$nTd3OV33zfM/lfQTIPKN7OrxL4uCQqRotJXXERqDhzeVB9Dlfmlum | admin2@example.com | Joe       | Admin      | t      |             | uaa.user    | t        | uaa    |             | uaa              |      | 2018-07-13 16:33:52 | f

(2 rows)
                                                          ^
uaadb=# update users set password='$2a$10$nTd3OV33zfM/lfQTIPKN7OrxL4uCQqRotJXXERqDhzeVB9Dlfmlum' where email = 'admin@example.com';
UPDATE 1
uaadb=# select * from users;
                  id                  |         created         |      lastmodified       | version |          username          |                           password                           |           email            | givenname | familyname | active | phonenumber | authorities | verified | origin | external_id | identity_zone_id | salt | passwd_lastmodified | legacy_verification_behavior
--------------------------------------+-------------------------+-------------------------+---------+----------------------------+--------------------------------------------------------------+----------------------------+-----------+------------+--------+-------------+-------------+----------+--------+-------------+------------------+------+---------------------+------------------------------
2731b250-7de0-4f88-ae34-0fbd33206c42 | 2018-07-13 16:33:52.737 | 2018-07-13 16:33:52.737 |       0 | admin2@example.com | $2a$10$nTd3OV33zfM/lfQTIPKN7OrxL4uCQqRotJXXERqDhzeVB9Dlfmlum | admin2@example.com | Joe       | Admin      | t      |             | uaa.user    | t        | uaa    |             | uaa              |      | 2018-07-13 16:33:52 | f

eb52fb6c-b588-4401-8ad4-97b0e04ffc23 | 2018-06-28 19:55:02.066 | 2018-06-28 19:55:02.066 |       0 | admin@example.com  | $2a$10$nTd3OV33zfM/lfQTIPKN7OrxL4uCQqRotJXXERqDhzeVB9Dlfmlum | admin@example.com  | Joe       | Admin      | t      |             | uaa.user    | t        | uaa    |             | uaa              |      | 2018-06-28 19:55:02 | f

(2 rows)

uaadb=# \q
bash-4.3# exit
[root@jwcbd cloudbreak-deployment]#

128 Views
0 Kudos
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎02-01-2019 03:52 PM
Updated by:
 
Contributors
Top Kudoed Authors