Provide credentials for CQL shell
Provide a username and password to connect to a node on an authentication enabled HCD cluster using credentials stored in the cqlshrc file or specified on the command line.
Use a cqlshrc file
Set credentials in a cqlshrc file:
-
Create or modify the
~/.cassandra/cqlshrcfile by adding an[authentication]section with ausernameandpassword.[authentication] username = <role_name> password = <password>See
cqlshrc.samplein your HCD installation for an example. -
Save the file in
<$HOME>/.cassandradirectory. -
Set permissions on the file to prevent unauthorized access because the password is stored in plain text:
chmod 440 <$HOME>/.cassandra/cqlshrc -
Check the permissions on
<$HOME>/.cassandra/cqlshrc_historyto ensure that plain text passwords are not compromised.
Use command line options
-
Pass only the username to be prompted for the password:
cqlsh -u <user_name> -
Pass both credentials on the command line:
cqlsh -u <user_name> -p <password>