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;

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; 


35 views
udemylinux.png

Join our newsletter! Get a free cloud server!  Never miss a post!

Thanks for submitting!