SSH 免密登录与安全加固:禁用密码登录只留密钥 [Copy Link]

一级用户组

服务器被暴力破解是常态,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,双保险。

New Post

Please log in to reply Login

uid:11 一级用户组
Follow
Posts 1
Comments 1
Followers 0
Following 0
Publish
Table of Contents
SSH 免密登录与安全加固:禁用密码登录只留密钥