What is an SSH Key?
SSH (Secure Shell) keys are a pair of cryptographic keys used for secure authentication when connecting to remote servers. They provide a more secure alternative to password-based authentication and are essential for modern DevOps, system administration, and secure server access.
SSH Key Components
- Public Key: Shared with servers you want to access. Safe to distribute.
- Private Key: Kept secret on your local machine. Never share this!
- Fingerprint: A hash of the public key used for verification.
SSH Key Algorithms Explained
Ed25519: The most modern and recommended algorithm. It's fast, secure, and generates compact keys. Based on elliptic curve cryptography, it provides excellent security with small key sizes.
RSA: The most widely supported algorithm. RSA 4096-bit keys offer very high security, while RSA 2048-bit keys provide good security with better compatibility on older systems.
ECDSA: Elliptic Curve Digital Signature Algorithm offers good security with smaller key sizes. Available in 256, 384, and 521-bit variants.
Best Practices for SSH Keys
- Use Ed25519 for new keys (best security and performance)
- Protect private keys with a strong passphrase
- Set correct file permissions (600 for private key, 644 for public key)
- Use different keys for different purposes (work, personal, etc.)
- Regularly rotate keys (every 1-2 years)
- Never share or expose your private key
- Use ssh-agent to manage keys securely
Common Use Cases
- Secure server access (SSH, SFTP)
- Git repository authentication (GitHub, GitLab, Bitbucket)
- Automated deployments and CI/CD pipelines
- Remote system administration
- Secure file transfers