+254725682556 +254725052660 info@ziprof.co.ke
Client Area

Security

How to Set Up SSH Key Authentication for Your Hosting Account

SSH key authentication replaces your account password with a matching pair of cryptographic keys: a private key that stays on your computer and a public key that you add to your hosting account. It is faster to use than typing a password every time you connect, and it is far harder for an attacker to guess or brute-force than even a strong password.

Before you start, make sure SSH Access is already enabled on your hosting account. If you have not done that yet, see How to Enable and Use SSH Access on Your Hosting Account first.

Step 1: Generate a key pair on your own computer

You can generate the key pair yourself (recommended, since your private key never leaves your machine) or generate it inside the control panel. To generate it yourself:

  • On macOS, Linux, or Windows with OpenSSH installed, open a terminal and run ssh-keygen -t ed25519 (or ssh-keygen -t rsa -b 4096 if your system does not support ed25519).
  • On older Windows setups, use PuTTYgen instead: open it, click Generate, move your mouse to create randomness, then save the private key with Save private key.

Either way, set a passphrase on the key when prompted. This protects the private key itself if your computer is ever compromised.

Never upload or email your private key to anyone, including ZIPROF support. Only the public key (the one usually ending in .pub) needs to go into your hosting account.

Step 2: Add the public key to your hosting account

In cPanel

  1. Log in to cPanel and go to Security, then click SSH Access.
  2. Click Manage SSH Keys.
  3. To use a key you already generated, click Import Key, paste your public key into the box, give it a name, and click Import. To generate a key directly on the server instead, click Generate a New Key, fill in the key name and size, and save it.
  4. Back on the Manage SSH Keys page, find your key in the list and click Manage next to it, then click Authorize. A key must be authorized before it can be used to log in.

In DirectAdmin

  1. Log in to DirectAdmin and look for SSH Keys under the account features.
  2. Paste the contents of your public key file into the provided text box and click Save. If your version of DirectAdmin offers a Create a new key option, you can use that instead to generate a pair on the server.
  3. Your key becomes active as soon as it is saved. Check the key list on the same page to confirm it was added.

Step 3: Connect using your private key

From your terminal, connect with the private key using the -i flag, for example: ssh -i /path/to/your/private_key -p [your SSH port] username@yourdomain.com. If you are using PuTTY on Windows, load your private key file under Connection > SSH > Auth before connecting, or run Pageant in the background with your key loaded.

If you set a passphrase in Step 1, you will be asked for it once per session (or once per login, depending on your SSH client's settings) instead of your account password.

Keep your account password enabled as a backup unless your hosting plan specifically supports disabling password login. If you lose your private key and password login has been switched off, you will need to contact support to regain access.

Removing a key later

If a device is lost or a key is no longer needed, go back to the same SSH Access (cPanel) or SSH Keys (DirectAdmin) page, find the key in the list, and remove or deauthorize it. This immediately stops that key from being able to log in, without affecting your account password or any other keys.