加固 SSH 与 root 登录
禁用密码、限制加密套件、root 仅限密钥登录并安装 fail2ban——五分钟消除 99% 的 SSH 风险。
每个公网 VPS 上线几分钟就会被扫描 SSH。NoctisNode 默认仅密钥供应,再加几行配置就能让爆破失去意义。
sshd_config
# /etc/ssh/sshd_config.d/hardened.conf
PermitRootLogin prohibit-password
PasswordAuthentication no
KbdInteractiveAuthentication no
AllowUsers root deploy
MaxAuthTries 3fail2ban
apt install -y fail2ban
printf '[sshd]\nenabled = true\nmaxretry = 3\nbantime = 3600\n' > /etc/fail2ban/jail.d/sshd.conf
systemctl enable --now fail2ban清单
- ▹使用 Ed25519 密钥;淘汰老掉牙的 RSA 密钥。
- ▹只有接受『能躲过扫描器、躲不过攻击者』这一事实,再把 SSH 移出 22 端口。
- ▹锁死自己之前,保留第二条登录通道(控制台/VNC)。