ssh-keygen -t ed25519 -C "me@example.com"
ssh-copy-id -p 2222 user@host
改 sshd 配置
PasswordAuthentication no
PermitRootLogin prohibit-password
ChallengeResponseAuthentication no
别急着断
sshd -t 检查语法,再 systemctl reload sshd。
先开一个新终端验证能登,确认没问题再关掉老会话。锁在门外就麻烦了。