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?
- Log on to ambari server host shell
ssh ambari-server01.domainname.com
- Stop ambari server
sudo ambari-server stop
- 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
- If your ambari database is psql or mysql:
- Connect to the database
psql -U ambari-server ambari
or
mysql -h <mysqldbhost> -P 3306 -u ambari -p
- Enter password ****
(this password is stored in /etc/ambari-server/conf/password.dat) - 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‘
- Quit the connection to database.
- Restart ambari-server
sudo ambari-server restart
- On your browser, you may proceed to ambari-server01.domainname.com:8080 and sign in with ‘admin/admin‘ credentials.