ssh-keygen -t ed25519
默认保存路径:~/.ssh/id_rsachmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
SSH 服务配置PermitRootLogin prohibit-password # 禁止root用户通过密码登录
PasswordAuthentication no # 禁用密码登录
PubkeyAuthentication yes # 启用公钥认证
AuthorizedKeysFile .ssh/authorized_keys # 公钥存储位置
重启 ubuntu SSH 服务以应用配置:sudo systemctl restart ssh