|
SSH hardening checklist - locking down a new server - Printable Version +- TalkativeTurtles (https://talkativeturtles.club) +-- Forum: Technology (https://talkativeturtles.club/forumdisplay.php?fid=2) +--- Forum: Networking & Cybersecurity (https://talkativeturtles.club/forumdisplay.php?fid=12) +--- Thread: SSH hardening checklist - locking down a new server (/showthread.php?tid=100) |
SSH hardening checklist - locking down a new server - Zero Two - 06-22-2026 Every new VPS I spin up goes through this checklist before anything else is deployed. SSH is the most exposed attack surface on a Linux server. Change the default SSH port (optional but reduces noise) Code: # /etc/ssh/sshd_configDisable root login Code: PermitRootLogin noDisable password authentication (keys only) Code: PasswordAuthentication noLimit the login grace period Code: LoginGraceTime 20Specify allowed users Code: AllowUsers yourusernameDisable unused features Code: X11Forwarding noUse a modern key algorithm Generate keys with ssh-keygen -t ed25519. If you have old RSA keys on the server, keep them but prefer ed25519 for new ones. Install fail2ban Code: sudo apt install fail2banAfter all changes: Code: sudo sshd -t # test config syntax before reloadingKeep your current session open and test login in a new terminal before closing anything. Never reload SSH blind. |