Handling superuser account in Cassandra

In this article, we are going to discuss how to handle the superuser account in Cassandra. In this, we will learn how to create a superuser account, how to give permissions privilege to the other user, how to grant access, etc.

In Cassandra, it is the best practice concerning the handling of the default super user account “cassandra” is to create a custom administrator account. The superuser account helps Cassandra manages the role.

1. Creating a superuser account in Cassandra :
To create a superuser account used the following cqlsh query.

create user 'admin' with password 'admin' superuser; 

To see the superuser role information ‘admin’ we can use the list roles command.

Now, if we want to see all the information related to the superuser role then used the following cqlsh query.


select * 
from system_auth.roles; 


2. Logging into a superuser account :
Now, we are going to log in with admin (superuser) credentials.

cassandra@cqlsh> login admin
Password: admin


3. Granting the permissions :
Now, we will see how we can use the grant access on a specific keyspace such that if we want to read access on University keyspace to the ‘User’ role then we will use the grant command.

grant select permission on keyspace University to 'User'; 

Now, we can see the permissions which are grant by the superuser for a specific role.


4. Logging into a normal user account :
To read data from student table and keyspace of student table is University.


Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.