部署密钥
部署密钥
ssh-keygen -t ed25519 -C 'ops@example'
ssh-copy-id -i ~/.ssh/id_ed25519.pub ops@10.0.0.9
# 服务端权限
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys
restorecon -Rv ~/.ssh 2>/dev/null || true关闭口令登录
关闭口令登录
PasswordAuthentication no
PubkeyAuthentication yes
sshd -t && systemctl reload sshd关闭口令登录后密钥损坏或丢失将无法登录:保留带外通道,密钥有备份与撤销流程。