What are the first sshd_config changes you make on a new production server?
BeginnerProductionSSH & Access Hardening
Answer
# /etc/ssh/sshd_config.d/10-hardening.conf
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
LoginGraceTime 30
X11Forwarding no
AllowGroups ssh-users
ClientAliveInterval 300
ClientAliveCountMax 2
sudo sshd -t && sudo systemctl reload ssh # 'sshd' on RHEL
Keep your current session open and test a new login before closing it.
More on SSH & Access Hardening
Why use a drop-in file in /etc/ssh/sshd_config.d/ instead of editing sshd_config?IntermediateWhy disable SSH password authentication entirely?BeginnerShould you change the SSH port from 22?IntermediateWhat are SSH certificates and why do large fleets use them?AdvancedHow do you restrict what a specific SSH key can do?AdvancedHow do you apply different sshd rules for different users or networks?Intermediate