howtouselinux

How to create user/permission with examples in Cassandra?

Table of Contents

CREATE USER in Cassandra

CREATE USER alice WITH PASSWORD ‘password_a’ SUPERUSER;
CREATE USER bob WITH PASSWORD ‘password_b’ NOSUPERUSER;

CREATE USER is equivalent to CREATE ROLE where the LOGIN option is true. So, the following pairs of statements are equivalent:

CREATE USER alice WITH PASSWORD ‘password_a’ NOSUPERUSER;
CREATE ROLE alice WITH PASSWORD = ‘password_a’ AND LOGIN = true AND SUPERUSER = false;

ALTER USER

ALTER USER alice WITH PASSWORD ‘PASSWORD_A’;
ALTER USER bob SUPERUSER;

LIST USERS

LIST ROLES;
LIST USERS;

GRANT PERMISSION

GRANT SELECT ON ALL KEYSPACES TO data_reader;
GRANT MODIFY ON KEYSPACE keyspace1 TO data_writer;
GRANT DROP ON keyspace1.table1 TO schema_owner;

REVOKE PERMISSION

REVOKE SELECT ON ALL KEYSPACES FROM data_reader;
REVOKE MODIFY ON KEYSPACE keyspace1 FROM data_writer;
REVOKE DROP ON keyspace1.table1 FROM schema_owner;
REVOKE EXECUTE ON FUNCTION keyspace1.user_function( int ) FROM report_writer;
REVOKE DESCRIBE ON ALL ROLES FROM role_admin;

LIST PERMISSIONS

LIST ALL PERMISSIONS OF alice;
LIST ALL PERMISSIONS ON keyspace1.table1 OF bob;
LIST SELECT PERMISSIONS OF carlos;

Linux Troubleshooting Guide:

Linux Learning Guide:

David Cao
David Cao

Hey there! I am David, a Cloud & DevOps Enthusiast and 18 years of experience as a Linux engineer. I work with AWS, Git & GitHub, Linux, Python, Ansible, and Bash. I am a technical blogger and a Software Engineer, enjoy sharing my learning and contributing to open-source.