sshd_config 关键项
sshd_config 关键项
# /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 1
X11Forwarding no生效与验证
生效与验证
sshd -t
systemctl reload sshd
sshd -T | grep -E 'permitrootlogin|passwordauthentication|maxauthtries'改配置前保留一个已登录会话;先验证密钥登录可用再禁用口令登录,避免锁死自己。