错误
[root@jenkins .ssh]# ssh-copy-id -i id_rsa_driver.pub root@192.168.0.96
The authenticity of host '192.168.0.96 (192.168.0.96)' can't be established.
RSA key fingerprint is a7:78:59:bd:6b:a5:02:3c:6e:85:9a:4c:7b:08:77:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.96' (RSA) to the list of known hosts.
Permission denied (publickey,password).
解决办法
采用多对公钥私钥时,由于操作顺序不当常会出现此问题,正确操作步骤如下:
- ssh-copy-id -i id_rsa_driver.pub root@192.168.0.96
- 修改config配置文件内容如下:
Host 192.168.0.96
HostName 192.168.0.96
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_driver
user root