If you forget the admin credentials of Cloudera manager, do not worry. We have an option. For this trick, you should know the metadata database credentials of the Cloudera manager.

The database credentials will be available in the Cloudera manager configuration file. The default location of this file is

/etc/cloudera-scm-server/db.properties

The sample contents of this file is given below.

com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=192.168.10.201
com.cloudera.cmf.db.name=cloudera_manager
com.cloudera.cmf.db.user=cm_user
com.cloudera.cmf.db.setupType=EXTERNAL
com.cloudera.cmf.db.password=cm_password

From this file, we can collect the details of the Cloudera manager database. Here in my case, the database is a MySQL server.

Now connect to the database server using the connection details present in the configuration file.

mysql -u username -h host -p 

Now enter into the cloudera manager database. In my case, the database name is cloudera_manager.

show databases;

use cloudera_manager;

show tables;

In the tables, you can see a table with the name USERS. All the Cloudera manager user details are stored in this table. The hash of the password and the salt are stored in this table. This is one way hashing. So we cannot recover the password from the hash. The best way is to update these fields with the hash and salt of a known password.

Here we are going to update the hash and salt of the admin user. You can apply this technique for any user.

The default admin user of cloudera manager is admin.

Now let us update the password of the admin user with the help of the following query.

update USERS set password_hash='9f7e3270b1aaa4931d38845a0334e66b2dd93f916439006fac4e5e2535a444b3', password_salt=-5357030608435271136 WHERE user_name = 'admin';

This will update the password of admin user as admin.

Now login to the Cloudera manager web UI and enter the credentials.

Username: admin

Password: admin

Wow success….!!!!!

I hope this tip is useful. Please comment below if you have any questions or feedback.