Skip to main content

How to connect to ClickHouse using SSH Keys

How to connect to ClickHouse and ClickHouse Cloud using SSH Keys

Question

How can I connect to ClickHouse using SSH Key Authentication?

Note

We use ClickHouse Cloud as an example here, but this example should also work on oss ClickHouse.

Answer

  1. Use ssh-keygen to create the keypair. Example:
  1. Use the public key (ch_key.pub in above example) to create the USER.
  1. Run SHOW users to confirm the user creation.

  2. Grant default_role to the user (optional).

  1. Use the private key now to authenticate against the service.
· 2 min read