以下是Ubuntu SSH安全配置指南:
/etc/ssh/sshd_config,找到#Port 22,取消注釋并改為非標準端口(如2222),重啟SSH服務使更改生效。/etc/ssh/sshd_config中,將PermitRootLogin設為no,防止root用戶直接SSH登錄。authorized_keys文件,編輯sshd_config確保PubkeyAuthentication為yes,并禁用密碼認證(PasswordAuthentication no)。sshd_config中使用AllowUsers或DenyUsers參數,限制特定用戶或IP地址訪問SSH。sudo ufw allow 2222,并啟用防火墻sudo ufw enable。sudo apt update && sudo apt upgrade更新系統和SSH軟件包,修復安全漏洞。