服务器被暴力破解是常态,SSH 密钥登录 + 禁用密码是最基本的防线。
生成并分发密钥
ssh-keygen -t ed25519
ssh-copy-id user@host
# 验证明文密码无法登录 加固 sshd_config
PasswordAuthentication no
PermitRootLogin prohibit-password
PubkeyAuthentication yes
MaxAuthTries 3
LoginGraceTime 30 变更端口+fail2ban
换个非默认端口能挡掉绝大多数扫描器;再配 fail2ban 封爆破 IP,双保险。