生成密钥(本地未生成过密钥)
ssh-keygen -t rsa
上传密钥(本地生成过密钥)
1.客户端(本地):
scp /Users/lirui/.ssh/id_rsa.pub root@服务器地址:/root/.ssh/lr_id_rsa.pub
2.服务端(服务器):
cd /root/.ssh
cat lr_id_rsa.pub >> authorized_keys
参考链接:https://blog.csdn.net/u014644574/article/details/123707195