ssh-copy-id error

created at 11-27-2021 views: 2

error

[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).

Solution

When multiple pairs of public and private keys are used, this problem often occurs due to improper operation sequence. The correct operation steps are as follows:

  • ssh-copy-id -i id_rsa_driver.pub root@192.168.0.96
  • Modify the content of the config configuration file as follows:
Host 192.168.0.96
    HostName 192.168.0.96
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_driver
    user root
created at:11-27-2021
edited at: 11-27-2021: