Using cqlsh with authentication
You can use a `cqlshrc` file to set default credentials when launching `cqlsh`.
-
Create or modify a
cqlshrc
file that specifies a role name and password:[authentication] username = fred password = !!bang!!$
For more information about the
cqlshrc
file, see Configuring a cqlshrc file. -
Save the file in
home/.cassandra
directory.If this is a new file, make sure to name it
cqlshrc
. -
Set permissions on the file to prevent unauthorized access because the password is stored in plain text. The file must be readable by the user that starts
cassandra
.chmod 440 'home/.cassandra/cqlshrc'
-
Check the permissions on
home/.cassandra/cqlshrc_history
to ensure that plain text passwords are not compromised.