Skip to main content

How to Connect to a cPanel Account With SSH Key Authentication

You can use SSH key authentication to connect to your server via SSH instead of using a password. This method provides a more secure way to manage your account and perform command-line tasks.

Important: This feature is only available on Hostek plans that support SSH access.

Before you begin

You will need:

  • A cPanel account

  • A local machine with an SSH client (such as PuTTY, OpenSSH, or Terminus)

  • A generated SSH public key and its corresponding private key

Create and Authorize an SSH Key in cPanel

Before you can connect using a key, you must generate and add the key to your cPanel account.

  1. Log in to your cPanel account.

  2. Locate the Security section and select SSH Access.

  3. Click Manage SSH Keys.

  4. Click Generate New Key.

  5. Enter a name for the key (e.g., id_rsa_host).

  6. Click Generate.

  7. Once the key is generated, find it in the list and click Manage.

  8. Click Authorize to make the key available for use.

Connect to your account using the SSH key

Once the key is authorized in cPanel, you can use it to connect from your local machine.

  1. Open your SSH client on your local computer.

  2. Configure the connection using your server's IP address or hostname and the specific port (usually 22).

  3. Select the private key file you generated (or the one you uploaded to cPanel) as the authentication method.

  4. Enter your username.

  5. Establish the connection.

Warning: Never share your private key with anyone. If you believe your private key has been compromised, delete the key from your cPanel account immediately and generate a new one.

Confirm the result

  • The SSH client successfully establishes a connection to the server.

  • You are prompted for a password only if the key is not recognized or if "Password Authentication" is still required by the server configuration.

Limitations

This procedure requires that the "SSH_AUTH_SOCK" or equivalent environment variable is correctly configured in your local SSH client. If you are using a third-party tool like PuTTY, you may need to use an agent like Pageant to load your private key.

Did this answer your question?