用ssh-copy-id将公钥复制到远程机器中
将本地公钥拷贝至 用户名为root的远程主机上
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.150.128/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/jenkins_home/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.150.128's password: # 输入远程账号的密码
测试远程登陆
ssh root@192.168.150.128
成功