Provide credentials for CQLSH

Provide a username and password to connect to a node on an authentication-enabled DataStax Enterprise (DSE) cluster using credentials stored in the cqlshrc file or passed on the command line.

If problems occur while authenticating, use the --debug option to show CQL shell settings and connection details.

Use cqlshrc

  1. Edit the cqlshrc file. The location of this file depends on the type of installation:

    • Package installations: /etc/dse/cassandra

    • Tarball installations: <installation_location>/resources/cassandra/conf

  2. Create or modify the ~/.cassandra/cqlshrc file by adding an [authentication] section with a username and password:

    [authentication]
    username = <role_name>
    password = <password>

    See cqlshrc.sample for an example.

  3. Save the file in <$HOME>/.cassandra directory.

  4. Set permissions on the file to prevent unauthorized access, because the password is stored in plain text:

    chmod 440 <$HOME>/.cassandra/cqlshrc
  5. Check the permissions on <$HOME>/.cassandra/cqlshrc_history to ensure that plain text passwords are not compromised.

  6. Start cqlsh.

    cqlsh

Use command line options

Start cqlsh and provide authentication credentials.

If you provide only the username, then cqlsh prompts for the password:

cqlsh -u <user_name>

If you provide both the username and password, then cqlsh uses the provided credentials to connect to the node:

cqlsh -u <user_name> -p <password>

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2025 | Privacy policy | Terms of use Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM