All guides
Home Glossary SSH key
Term

SSH key

An authentication credential for the SSH protocol that uses a pair of cryptographic keys for secure server access.

An SSH key is an authentication credential for the SSH protocol that uses a pair of cryptographic keys for secure server access. Unlike traditional passwords, SSH keys resist brute-force attacks and enable automated, passwordless logins for administrators and deployment tools. They are the standard authentication method for Linux server administration, infrastructure-as-code workflows with Ansible or Terraform, and Git repository access.

How it works

SSH key authentication relies on asymmetric cryptography, which splits credentials into two mathematically linked files:

  • Public key: A shareable file (typically ending in .pub) placed on the remote server inside the user's ~/.ssh/authorized_keys file.
  • Private key: A secret file stored strictly on the client machine that must never be shared or uploaded to remote hosts.

When a client initiates a connection, the server uses the stored public key to issue a cryptographic challenge. The client signs this challenge with its private key and sends back the signature. Because the server can verify the signature against the public key, authentication succeeds without the private key ever crossing the network.

Example

Generate a modern key pair on your local workstation using the Ed25519 algorithm, which offers strong security and fast performance with a compact 256-bit key length compared to legacy 2048-bit or 4096-bit RSA keys:

ssh-keygen -t ed25519 -C "deploy@workstation"

Once created, copy the public key to your target server and verify the connection:

ssh-copy-id -i ~/.ssh/id_ed25519.pub [email protected]
ssh -i ~/.ssh/id_ed25519 [email protected]

For a complete walkthrough of client setup and server hardening, see SSH Key Configuration: A Professional Guide to Secure Access.

What matters when choosing a server or hosting

When evaluating VPS, dedicated server, or cloud hosting providers, verify how they handle initial SSH provisioning:

  • Control panel key injection: Good providers allow you to upload public keys in their dashboard and automatically inject them into new instances during deployment.
  • Password authentication defaults: Security-focused cloud platforms disable password login over SSH by default, requiring an SSH key from first boot.
  • Algorithm support: Ensure the default operating system images ship with an OpenSSH version that supports Ed25519 keys alongside RSA.
  • Out-of-band console access: Look for a browser-based serial or VNC console so you can recover access if you misconfigure firewall rules or key permissions.

Common mistakes

  • Incorrect file permissions: OpenSSH rejects key logins if permissions are too open. Keep ~/.ssh set to 700, authorized_keys to 600, and your local private key to 600.
  • Leaving password login enabled: Adding an SSH key does not automatically block brute-force attacks unless you set PasswordAuthentication no in /etc/ssh/sshd_config.
  • Omitting a passphrase: Storing an unencrypted private key on a laptop risks immediate server compromise if the device is stolen; protect keys with a strong passphrase and use ssh-agent.
  • Reusing one key everywhere: Sharing a single key pair across multiple team members or environments complicates revocation when a device is lost or a developer leaves.

You can review additional hardening steps in SSH Key Configuration: A Professional Guide to Secure Access.

FAQ

Should I choose Ed25519 or RSA for new SSH keys?

Choose Ed25519 for all modern Linux servers and Git hosts because it is faster to verify and uses shorter keys. Only fall back to 4096-bit RSA when connecting to legacy network appliances or outdated operating systems that lack Ed25519 support.

What happens if I lose my private key?

You cannot regenerate a lost private key from the public key on the server. To regain access, log in through your hosting provider's web console or rescue mode and replace the old entry in ~/.ssh/authorized_keys with a newly generated public key.

Can I use the same public key on multiple servers?

Yes. Because the public key is safe to distribute, you can append the same .pub line to authorized_keys across as many servers as you manage from that local machine.

All glossary terms

Glossary

Related terms

Full glossary

New guides every week.

A digest of the best pieces on servers, VPN and self-hosted software. No ads, no spam.

1 email a weekOne-click unsubscribeRU · EN
Only slipjar.app articles, nothing else.