https://blog.csdn.net/qq_38250124/article/details/84946131
1.开启允许pubkey登录
vi /etc/ssh/sshd_config #PubkeyAuthentication yes #改为 PubkeyAuthentication yes
重启sshd服务
systemctl restart sshd
2.设置xxx账户 sudo 无密码权限
visudo xxx ALL=(ALL) NOPASSWD: ALL 或者将该用户添加到wheel组 启用 ## Allows people in group wheel to run all commands # %wheel ALL=(ALL) ALL ## Same thing without a password %wheel ALL=(ALL) NOPASSWD: ALL
3.上传id_rsa.pub到/home/xxx/.ssh
cat id_rsa.pub >> authorized_keys