← Back to Security & SSL

Setting Up SSH Key Authentication

SSH key authentication is more secure than password-based login β€” it uses a cryptographic key pair that cannot be brute-forced. This guide covers generating and installing SSH keys.

Step 1: Generate an SSH Key Pair

On your local computer, open a terminal and run:

ssh-keygen -t ed25519 -C "your@email.com"

Accept the default file location. Set a passphrase for additional security. This creates two files: ~/.ssh/id_ed25519 (private key β€” keep secret) and ~/.ssh/id_ed25519.pub (public key β€” share this).

Step 2: Import the Public Key via cPanel

In cPanel, go to Security > SSH Access > Manage SSH Keys > Import Key. Paste the contents of your id_ed25519.pub file, give it a name, and click Import. Then click Manage next to the imported key and click Authorize.

Step 3: Connect Using the Key

Now connect via SSH:

ssh -i ~/.ssh/id_ed25519 username@yourdomain.com

If your key has a passphrase, you'll be prompted for it once. After that, the connection is established without needing your cPanel password.

Was this article helpful?

On This Page