Harden SSH on Arch Linux
Back up config
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
Key settings (/etc/ssh/sshd_config)
Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X11Forwarding no
PermitEmptyPasswords no
LoginGraceTime 30
MaxAuthTries 3
MaxSessions 5
Ciphers [email protected],[email protected]
MACs [email protected],[email protected]
KexAlgorithms curve25519-sha256,[email protected]
LogLevel VERBOSE
Test and restart
sshd -t && systemctl restart sshd 2>/dev/null || systemctl restart ssh