远程执行程序或免秘钥远程登录 都需要将公网秘钥发送到目的服务器上。
1 创建秘钥
[root@wzlvm ~]# ssh-keygen
一直按回车即可
2 发送公网秘钥到服务器
在~/.ssh目录下有刚创建的公网秘钥id_rsa.pub 发送到服务器
[root@wzlvm ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub myvm2
3 免密登录
[root@wzlvm ~]# ssh myvm2Warning: the RSA host key for 'myvm2' differs from the key for the IP address '192.168.125.129'Offending key for IP in /root/.ssh/known_hosts:2Matching host key in /root/.ssh/known_hosts:3Are you sure you want to continue connecting (yes/no)? yesLast login: Wed Oct 19 17:25:03 2016 from 192.168.125.128[root@myvm2 ~]#