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.
cassandra@cqlsh> 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.
cassandra@cqlsh> 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 admin@cqlsh>
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.
admin@cqlsh> 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.