SSH Hardening
Key-based authentication, sshd_config hardening, jump hosts, port forwarding, and certificate-based auth.
Overview
SSH is the primary remote access mechanism for Linux servers. Default configurations are permissive, so production servers require explicit hardening. The work falls into four areas: who may log in and how, what the network sees, how repeated guessing is stopped, and how you hop between hosts.
Authentication Hardening
Start with authentication, because it decides who gets a shell at all.
- Disable password authentication with PasswordAuthentication no.
- Disable root login with PermitRootLogin no.
- Restrict logins to specific users or groups with AllowUsers and AllowGroups.
- Use ed25519 keys. They are faster and stronger than RSA 2048.
Key concepts
- PasswordAuthentication no
- ed25519 keys
- ProxyJump
- SSH CA
- fail2ban
Interview questions
- How do you set up a secure bastion host pattern for accessing private EC2 instances?
- Explain how certificate-based SSH works and why it is better than authorized_keys management.
Sign up free to read the full topic
More Linux topics
Start free on Cariara · Coding problems · System design studio