Security

SSH access in cPanel: generate, import and authorise SSH keys

Connect to your cPanel hosting over SSH with keys: generate or import a key in cPanel SSH Access, authorise it, and connect from Windows, macOS or Linux.

IntermediatecPanel hosting2 min read

SSH gives you a command line on your hosting account, which is useful for WP-CLI, Composer, Git, large imports and quick file searches. On cPanel, SSH is best used with keys instead of passwords: they are more secure and you never type a password. You manage them in cPanel → Security → SSH Access.

Before you start

  • SSH must be enabled for your account. If SSH Access is missing or connections are refused, open a support ticket to request it.
  • An SSH client: Windows 10/11 PowerShell (built in), macOS or Linux Terminal, or PuTTY.
  • If you only need a quick shell, cPanel's browser Terminal needs no setup.
  1. On your computer, create a key if you do not have one:
    ssh-keygen -t ed25519 -C "me@laptop"
    Press Enter to accept the path and set a passphrase.
  2. Show the public key: cat ~/.ssh/id_ed25519.pub (Windows: type $env:USERPROFILE\.ssh\id_ed25519.pub).
  3. In cPanel open Security → SSH Access → Manage SSH Keys → Import Key.
  4. Give it a name, paste the public key into the public key box (leave the private key box empty) and click Import.
  5. Back in Manage SSH Keys, under Public Keys, click Manage next to the key and then Authorize.

Option B: generate a key in cPanel

  1. In Manage SSH Keys click + Generate a New Key.
  2. Enter a strong passphrase, choose RSA 4096 or the default, and click Generate Key.
  3. Authorize the new public key as above.
  4. Under Private Keys, click View/Download. Download the key; for PuTTY click Convert to get a .ppk file.

Warning: A private key is like a password. After downloading a key generated in cPanel, delete the private key from cPanel so it is not stored on the server.

Connect

SettingValue
HostYour domain or the server hostname
Port22 unless your welcome email says otherwise
UsernameYour cPanel username (not an email address)
ssh -i ~/.ssh/id_ed25519 cpuser@yourdomain.com

In PuTTY, set the host, then Connection → SSH → Auth → Credentials and choose the .ppk file. See use SSH keys with PuTTY and Pageant. The same key works for SFTP in FileZilla (Logon Type: Key file).

What you can do over SSH

  • Check disk use: du -sh ~/* | sort -h
  • Import a database: mysql -u cpuser_db -p cpuser_db < dump.sql
  • WordPress tasks with WP-CLI: wp plugin update --all
  • Composer and Git commands in your project folders

Shared hosting uses a restricted (jailed) shell: you cannot use sudo or install system packages.

Troubleshooting

  • Permission denied (publickey): the key is imported but not authorised, or you used the wrong username.
  • Connection refused or timed out: SSH not enabled, a wrong port, or your IP is blocked after failed attempts. Contact support with your IP from the IP checker.
  • Too many authentication failures: see this fix.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.