Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset a lost Cassandra admin user's password?

I have full access to the Cassandra installation files and a PasswordAuthenticator configured in cassandra.yaml. What do I have to do to reset admin user's password that has been lost, while keeping the existing databases intact?

like image 979
Eemeli Kantola Avatar asked Aug 23 '13 09:08

Eemeli Kantola


2 Answers

The hash has changed for Cassandra 2.1:

  1. Switch to authenticator: AllowAllAuthenticator
  2. Restart cassandra
  3. UPDATE system_auth.credentials SET salted_hash = '$2a$10$H46haNkcbxlbamyj0OYZr.v4e5L08WTiQ1scrTs9Q3NYy.6B..x4O' WHERE username='cassandra';
  4. Switch back to authenticator: PasswordAuthenticator
  5. Restart cassandra
  6. Login as cassandra/cassandra
  7. CREATE USER and ALTER USER to your heart's content.
like image 115
stub Avatar answered Oct 04 '22 01:10

stub


Solved with the following steps:

  1. Change authenticator in cassandra.yaml to AllowAllAuthenticator and restart Cassandra
  2. cqlsh
  3. update system_auth.credentials set salted_hash='$2a$10$vbfmLdkQdUz3Rmw.fF7Ygu6GuphqHndpJKTvElqAciUJ4SZ3pwquu' where username='cassandra';
  4. Exit cqlsh
  5. Change authenticator back to PasswordAuthenticator and restart Cassandra

Now you can log in with

cqlsh -u cassandra -p cassandra

and change the password to something else.

like image 30
Eemeli Kantola Avatar answered Oct 04 '22 01:10

Eemeli Kantola