Linux
•
•
By Fiona
SSH 安全加固指南:除了改 Port 還能做什麼?
守護伺服器的大門
修改 SSH Port (如 22 -> 2222) 只能防君子防不了掃描器。更嚴謹的加固措施包含:
- 強制金鑰登入:在
/etc/ssh/sshd_config設定PasswordAuthentication no與PubkeyAuthentication yes。 - 禁止 Root 直連:設定
PermitRootLogin no,強迫攻擊者必須先猜到普通使用者名稱。 - 限制特定群組:使用
AllowGroups ssh-users,只允許特定群組成員登入。 - 雙因子驗證 (2FA):整合
libpam-google-authenticator,登入時需輸入手機 OTP 碼,將安全性提升到銀行等級。