An SSH key lets you log in to your hosting account's command line without typing your cPanel password, and it's far harder for an attacker to guess than any password. This guide shows you how to create an SSH key on Windows, Mac and Linux, add it to cPanel, load it into an SSH agent so you only type the passphrase once, and use it with PuTTY and FileZilla.
How SSH keys work (in plain English)
An SSH key is really a pair of files that belong together:
- The private key (for example
id_ed25519) stays on your computer. Treat it like a house key: never email it, never paste it into a ticket, never upload it to your website. - The public key (the same name ending in
.pub) is safe to share. You give it to cPanel, and cPanel adds it to the list of keys allowed to log in to your account.
When you connect, the server asks your computer to prove it holds the private key that matches one of the authorized public keys. The private key itself never crosses the internet. That's why keys are safer than passwords: there's nothing to phish, and nothing that can be guessed by trying thousands of combinations.
A passphrase is an optional password that locks the private key file on your computer. If your laptop is stolen, the thief can't use the key without the passphrase. We recommend setting one, and this guide shows how to avoid retyping it all day.
Before you start
- Your account needs shell (SSH) access. If you don't see Advanced > Terminal in cPanel, or logins are refused even with the correct password, open a ticket and ask.
- You'll need your cPanel username. It's shown in the General Information panel on the right of the cPanel home page. It is not your email address or your domain name.
- SSH runs on the standard port, 22. The host name is your domain (for example
example.com) or, if your domain doesn't point to us yet,secure.instantaccess.net.
Which type of key should I make?
| Key type | When to use it |
|---|---|
| Ed25519 | The best choice for almost everyone. Short, fast and secure. Supported by current Windows, macOS, Linux, PuTTY and FileZilla. |
| RSA 4096 | Use this only if an older program you rely on doesn't understand Ed25519 keys. |
Step 1: Create the key on your computer
Windows 10 and 11 (built-in OpenSSH)
Windows 10 and 11 include the same ssh-keygen tool that Mac and Linux use.
- Right-click the Start button and choose Terminal (or Windows PowerShell on older versions).
- Type this command, using your own email address as a label, and press Enter:
ssh-keygen -t ed25519 -C "you@example.com" - When asked Enter file in which to save the key, press Enter to accept the default (
C:\Users\YourName\.ssh\id_ed25519). - Type a passphrase and press Enter, then type it again. Nothing appears on screen while you type -- that's normal.
If you see 'ssh-keygen' is not recognized, the OpenSSH Client is switched off. Go to Settings > System > Optional features (on Windows 10: Settings > Apps > Optional features), click View features or Add a feature, install OpenSSH Client, then open a new Terminal window.
Mac
- Open Terminal (in Applications > Utilities, or press Command + Space and type Terminal).
- Run:
ssh-keygen -t ed25519 -C "you@example.com" - Press Enter to accept the default location (
/Users/yourname/.ssh/id_ed25519), then set a passphrase.
Linux
Open a terminal and run the same command as on a Mac. If ssh-keygen is missing, install your distribution's OpenSSH client package (for example sudo apt install openssh-client on Ubuntu or Debian).
What you should see
After the passphrase, ssh-keygen prints something like this:
Your identification has been saved in /Users/yourname/.ssh/id_ed25519
Your public key has been saved in /Users/yourname/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:q3Vx...8kTw you@example.com
If it asks Overwrite (y/n)?, you already have a key with that name. Answer n -- overwriting it would lock you out of every server that uses the old key. Either use the key you already have, or run the command again and type a different file name, such as ~/.ssh/id_ed25519_hosting.
Step 2: Copy your public key
Display the public key and copy the whole line, from ssh-ed25519 to the email address at the end:
| System | Command |
|---|---|
| Windows (PowerShell) | Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard (copies it straight to the clipboard) |
| Mac | pbcopy < ~/.ssh/id_ed25519.pub (copies it straight to the clipboard) |
| Linux | cat ~/.ssh/id_ed25519.pub, then select and copy the line |
A public key is one long line that looks like this:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ3m...Qx7 you@example.com
Make sure you copy the file ending in .pub. If what you copied starts with -----BEGIN OPENSSH PRIVATE KEY-----, that's your private key -- don't paste it anywhere, and copy the .pub file instead.
Step 3: Add the key to cPanel and authorize it
- Log in to cPanel (from the client area: Services > My Services, choose your plan, then Log in to cPanel).
- Go to Security > SSH Access and click Manage SSH Keys.
- Click Import Key.
- In Choose a name for this key, type something that tells you which computer it belongs to, such as
office-laptop. A clear name makes it easy to remove the right key later. - Leave the private key box and passphrase box empty. Paste your public key into the Paste the public key box.
- Click Import, then Go Back.
- Under Public Keys, find your new key. Its status shows as not authorized. Click Manage, then Authorize.
A key that's imported but not authorized will not work. This is the step people miss most often.
Mac and Linux shortcut: ssh-copy-id
If you can already log in with your cPanel password, ssh-copy-id adds the key for you in one step:
ssh-copy-id -i ~/.ssh/id_ed25519.pub username@example.com
It appends the key to ~/.ssh/authorized_keys on your hosting account, which is the same file cPanel's Authorize button writes to. Windows doesn't include ssh-copy-id, so use cPanel's Import Key there.
Step 4: Test the connection
In Terminal or PowerShell, run (with your own username and domain):
ssh username@example.com
The first time, you'll see a message like The authenticity of host 'example.com' can't be established followed by a fingerprint. Type yes and press Enter. You'll then be asked for your key passphrase (not your cPanel password), and you'll land at a prompt in your home directory, such as [username@secure ~]$. Type exit to disconnect.
If you saved the key under a non-default name, tell SSH which one to use:
ssh -i ~/.ssh/id_ed25519_hosting username@example.com
If you're asked for a password instead of a passphrase, the key wasn't accepted. See the troubleshooting section below.
Step 5: Stop retyping the passphrase (SSH agent)
An SSH agent holds your unlocked key in memory, so you type the passphrase once per session instead of on every connection.
Windows
Open PowerShell as administrator and turn the agent on (it's off by default):
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
Then, in a normal PowerShell window, add your key and enter the passphrase once:
ssh-add $env:USERPROFILE\.ssh\id_ed25519
Mac
Add the key and store the passphrase in your macOS keychain:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Linux
Most desktop Linux systems start an agent when you log in. Run ssh-add ~/.ssh/id_ed25519 and enter the passphrase.
Step 6 (optional): Save a shortcut in your SSH config file
Instead of typing the username, host and key every time, create a text file called config (no extension) in your .ssh folder and add:
Host mysite
HostName example.com
User username
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
Now ssh mysite connects with the right settings. IdentitiesOnly yes stops SSH offering every key you own, which avoids "Too many authentication failures" if you have several keys. The same shortcut works with scp and sftp.
Using your key with PuTTY on Windows
PuTTY uses its own key format (.ppk). You can convert the key you made above:
- Open PuTTYgen (installed with PuTTY).
- Click Load, change the file filter to All Files (*.*), and open
C:\Users\YourName\.ssh\id_ed25519. Enter your passphrase. - Click Save private key and save it as, for example,
hosting.ppk. - In PuTTY, enter your domain as the Host Name, port 22. Go to Connection > SSH > Auth > Credentials and browse to the
.ppkfile under Private key file for authentication. Under Connection > Data, enter your cPanel username as the Auto-login username. - Go back to Session, type a name under Saved Sessions, click Save, then Open.
You can also create a new key directly in PuTTYgen: choose EdDSA (Ed25519) and click Generate. Copy the text in the box labelled Public key for pasting into OpenSSH authorized_keys file and import that into cPanel as in Step 3.
Using your key with FileZilla
If you use FileZilla with SFTP, open File > Site Manager, choose your site, set Protocol to SFTP - SSH File Transfer Protocol, set Logon Type to Key file and browse to your private key. FileZilla may offer to convert an OpenSSH key; accept it. Our guide to transferring files with SFTP and SCP covers the full settings.
Troubleshooting
I'm still asked for a password
- Check the key is authorized in Security > SSH Access > Manage SSH Keys.
- Check you pasted the
.pubfile and that it's all on one line with no line breaks added by your email or notes app. - If your key has a non-default name, add
-iwith its path or set up the config file above. - Run
ssh -v username@example.com. Look for lines startingOffering public key-- if your key isn't listed, SSH isn't finding it on your computer.
"Permission denied (publickey)"
The server didn't accept any key you offered. The usual causes are a wrong username, a key that isn't authorized, or file permissions. Our separate SSH errors guide walks through each fix.
"UNPROTECTED PRIVATE KEY FILE!" or "Permissions are too open"
SSH refuses to use a private key that other users on your computer could read. On Mac or Linux run chmod 600 ~/.ssh/id_ed25519. On Windows, this usually happens after copying the key from another computer; the SSH errors guide has the fix.
The connection times out
Repeated failed logins can get your IP address blocked by the server's firewall. Stop retrying, find your IP at whatismyipaddress.com and open a ticket with it.
Common questions
Should I generate the key in cPanel instead?
You can (Manage SSH Keys > Generate a New Key), but then the private key is created on the server and you have to download it. Creating it on your own computer means the private key never leaves your hands, which is the safer arrangement.
Can I use the same key on several computers?
It's better to make one key per computer and import each one with a clear name. If a laptop is lost, you remove just that key and the others keep working.
How do I remove a key?
In Manage SSH Keys, click Manage next to the key and choose Deauthorize, or click Delete Key to remove it completely. Do this straight away if a computer or backup containing your private key goes missing.
I forgot my passphrase
There's no way to recover it. Create a new key, import and authorize it, then delete the old one from cPanel.
Does this change my cPanel password or FTP logins?
No. The key is only used for SSH and SFTP. Your cPanel, FTP and email passwords stay the same.
Related guides
- How to Use SSH, SSH Keys and Terminal in cPanel
- How to Connect to Your Website with FileZilla (FTPS)
- How to Set Up Two-Factor Authentication (2FA) in cPanel
- How to Use Git Version Control in cPanel
- How to Log In to cPanel from the Client Area
Still stuck? Open a support ticket and the Instant Access Internet Services team will help.
