15

I'm logging in with on Ubuntu 14.10 on Cassandra 2.0.8 with Java 1.7.0_60-b19

cqlsh -u cassandra -p cassandra

I'm running:

CREATE USER a WITH PASSWORD 'a' NOSUPERUSER;

I'm getting the error:

Bad Request: Only superusers are allowed to perform CREATE USER queries

The problem with reasoning - I am logged in as the superuser.

My question is: If I'm logged into cqlsh as the Cassandra user, why am I told that I'm not the superuser?

hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • Before setting up the authenticator in cassandra.yaml, it assumes that you are an anonymous user. Hence, you don't have permission to create a superuser. – taurus05 Apr 02 '19 at 09:44

2 Answers2

23

You need to enable PasswordAuthenticator in cassandra.yaml file. To enable PasswordAuthenticator you need to change authenticator property in cassandra.yaml

Change

authenticator: AllowAllAuthenticator

to

authenticator: PasswordAuthenticator

After that login with following command and then you will be able to add new user

cqlsh -u cassandra -p cassandra
kkmishra
  • 699
  • 4
  • 10
  • 1
    just in case someone is looking to grant permissions as well, you would need to add below to cassandra.yaml. authorizer: CassandraAuthorizer – rohtakdev Feb 10 '15 at 01:27
3

1 Find and open 'cassandra.yaml' file on your computer.

2 Find and delete 'authenticator: AllowAllAuthenticator' in the file.

3 Replace it with 'authenticator: PasswordAuthenticator'

4 Also, add this line : 'authorizer: CassandraAuthorizer '

Restart Cassandra. If you use brew, you can restart using

brew services restart cassandra

then log in to cql shell again:

cqlsh -u cassandra -p cassandra localhost;

create a new super user

CREATE ROLE WITH SUPERUSER = TRUE AND LOGIN = TRUE AND PASSWORD = '';

exit out of cassandra

exit

log in using the new super user login

cql -u

Then you enter your password and you're in!

https://gist.github.com/GHesericsu/83aca87b60c853945e242b3b9a6ceef0/edit

eric su
  • 31
  • 1