generalcassandra

Modify the default administrator password

Modify the Cassandra administrator password

You can modify the Cassandra password using the following command at the shell prompt:

$ cqlsh -u cassandra -p PASSWORD
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.

cqlsh> ALTER USER cassandra with PASSWORD 'NEWPASSWORD';
cqlsh> exit

Reset the Cassandra administrator password

You can reset the administrator password by following the steps below:

  • Edit the /opt/bitnami/cassandra/conf/cassandra.yaml file and replace the following lines:

      authenticator: PasswordAuthenticator
      authorizer: CassandraAuthorizer
    

    with:

      authenticator: AllowAllAuthenticator
      authorizer: AllowAllAuthorizer
    
  • Restart your database:

      $ sudo /opt/bitnami/ctlscript.sh restart cassandra
    
  • Execute the following commands:

      $ cqlsh
      Connected to Test Cluster at 127.0.0.1:9042.
      [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
      Use HELP for help.
    
      cqlsh> UPDATE system_auth.roles SET salted_hash = '$2a$10$1gMPBy9zSkDzKxdbU2v/gOslcMRPDcXVqmwQYBmi8MVgYvNdRZw/.' WHERE role = 'cassandra';
      cqlsh> exit
    
  • Undo the changes made in /opt/bitnami/cassandra/conf/cassandra.yaml and restart Cassandra again. Now you can access your database using the user name cassandra and password cassandra:

      $ cqlsh -u cassandra -p cassandra
      Connected to Test Cluster at 127.0.0.1:9042.
      [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
      Use HELP for help.
      cqlsh>
    

Once you have access, don’t forget to change the cassandra user account password to something else as described in the previous section. This is the default password and it’s unsecure.

Last modification December 21, 2022