使用密钥和监控工具保护 SSH 登录,抵御暴力破解攻击。

  1. 编辑配置:nano /etc/ssh/sshd_config,然后设置 PermitRootLogin noPasswordAuthentication noPubkeyAuthentication yes
  2. 创建非 root 用户:adduser secureuserusermod -aG sudo secureuser
  3. 复制 SSH 密钥:在本地执行 ssh-copy-id secureuser@your-server-ip
  4. 安装 Fail2Ban:apt install fail2ban,并为 SSH 配置 jail。
  5. 重启:systemctl restart ssh
  6. 在关闭当前会话之前,先用新用户和密钥测试登录。

这篇指南对你有帮助吗?

感谢你的反馈!