0

I'm trying to reset the cassandra user's password as suggested here:

UPDATE system_auth.credentials SET salted_hash = '$2a$10$H46haNkcbxlbamyj0OYZr.v4e5L08WTiQ1scrTs9Q3NYy.6B..x4O' WHERE username='cassandra';

I'm getting the following error:

InvalidRequest: code=2200 [Invalid query] message="unconfigured table credentials"

My client is cqlsh 5.0.1.

How can I reset the cassandra password?

Cassandra was installed from datastax-ddc-3.7.0-1.noarch.rpm

Cassandra version is 3.7.0

Community
  • 1
  • 1
ealfonso
  • 6,622
  • 5
  • 39
  • 67

2 Answers2

1

In Cassandra 2.2 table name changed
Check the Cassandra Release News

New table is roles

CREATE TABLE system_auth.roles (
    role text PRIMARY KEY,
    can_login boolean,
    is_superuser boolean,
    member_of set<text>,
    salted_hash text
);

Use the below query :

UPDATE system_auth.roles SET salted_hash = '$2a$10$1PzCxcMNKgsBEcI1lf.ndut24xyO0N2LzRdRF1tzaMaSH9KFLz/0u' WHERE role = 'cassandra';
Ashraful Islam
  • 12,470
  • 3
  • 32
  • 53
  • update query is successful but now unable to log in with password: ```Connection error: ('Unable to connect to any servers', {'localhost': AuthenticationFailed(u'Failed to authenticate to localhost: code=0000 [Server error] message="java.lang.IllegalArgumentException: Invalid salt version"',)})``` – ealfonso May 19 '17 at 06:16
  • Which cassandra version are you using ?? I am using cassandra 2.2.4. May be the `salted_hash` value has changed in your version – Ashraful Islam May 19 '17 at 06:19
  • 3.7.0. How did you find out the salted hash for your version? – ealfonso May 19 '17 at 06:20
  • I have just execute `SELECT * FROM system_auth.roles WHERE role = 'cassandra'` – Ashraful Islam May 19 '17 at 06:22
  • Which will give you the `solted_hash` – Ashraful Islam May 19 '17 at 06:23
  • I got this hash: `SELECT salted_hash FROM system_auth.roles WHERE role = 'cassandra' => a0.zmw7dIjd2sN6URl/iOJUNND.EdLXJDK`, yet still getting the same error after updating with the same hash – ealfonso May 19 '17 at 06:36
  • It seems that the salt changes with each re-installation? I've gotten new salts: `$2a$10$gNwUkc82ZCl4NR5GPaBkMu0LxjYDHw2.SpdHu6NxIVlX9YuWrmxq2`, – ealfonso May 19 '17 at 06:51
  • 1
    In the end the following hash worked. Not sure why I was getting the previous ones: `'$2a$10$lvQJJvpW4U7zqVR6xMnzAObShR2EdWcNl3eY9A8cCOi1nIw2gfcU.'` – ealfonso May 22 '17 at 17:55
0

To change your password use this command:

ALTER USER <user_name> WITH PASSWORD <enter_new_password>

see http://docs.datastax.com/en/cql/3.1/cql/cql_reference/alter_user_r.html