Forgot ‘ambari’ password?

Working with multiple clusters at the same time can sometimes mean too many passwords to make note of! While for the major cluster(s), I prefer syncing with AD/LDAP, it may not be possible (worthwhile) to do so for every cluster you manage.

For security reasons, one must always change from the default ambari/ambari credentials. However, what to do in case you forgot the password for a (ambari – local) user?

  1. Log on to ambari server host shell
    ssh ambari-server01.domainname.com
  2. Stop ambari server
    sudo ambari-server stop
  3. Check for the following details in /etc/ambari-server/conf/ambari.properties
    server.jdbc.rca.url=jdbc:XXXXXXXXXXXXXXX/ambaridb
    server.jdbc.rca.user.name=ambari
    server.jdbc.rca.user.passwd=/etc/ambari-server/conf/password.dat
  4. If your ambari database is psql  or mysql:
  5. Connect to the database
    psql -U ambari-server ambari

    or

    mysql -h <mysqldbhost> -P 3306 -u ambari -p
  6. Enter password ****
    (this password is stored in /etc/ambari-server/conf/password.dat)
  7. In psql:
    update ambaridb.users set user_password='538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00' where user_name='admin'

    In mysql:

    mysql> select * from users;
    +---------+--------------+---------------------+-----------+-----------+-----------+----------------------------------------------------------------------------------+--------+------------------------------------+
    | user_id | principal_id | create_time | ldap_user | user_type | user_name | user_password | active | active_widget_layouts |
    +---------+--------------+---------------------+-----------+-----------+-----------+----------------------------------------------------------------------------------+--------+------------------------------------+
    | 1 | 1 | 2018-02-17 00:00:00 | 0 | LOCAL | admin | 1b445eb2cfdeb0519f68d95b7732f07136c692711c855798594a9ea2aa5c3aa17629820734a697a0 | 1 | [{"id":"6"},{"id":"7"},{"id":"8"}] |
    +---------+--------------+---------------------+-----------+-----------+-----------+----------------------------------------------------------------------------------+--------+------------------------------------+
    1 row in set (0.00 sec)
    mysql> update ambaridb.users set user_password='538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00' where user_name='admin';

    Note: The new password is ‘Hex-encoded string for ambari

  8. Quit the connection to database.
  9. Restart ambari-server
    sudo ambari-server restart
  10. On your browser, you may proceed to ambari-server01.domainname.com:8080 and sign in with ‘admin/admin‘ credentials.

admin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s