Skip to Content

How to create user/permission with examples in Cassandra?

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;

Get Your Free Linux training!

Join our free Linux training and discover the power of open-source technology. Enhance your skills and boost your career! Learn Linux for Free!

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: