ssh-copy-id:/usr/bin/ssh-copy-id: ERROR: No identities found

1 生成公私密钥对

[atguigu@hadoop102 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/atguigu/.ssh/id_dsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/atguigu/.ssh/id_dsa.
Your public key has been saved in /home/atguigu/.ssh/id_dsa.pub.
The key fingerprint is:
25:0a:23:7f:a7:f0:d1:78:f6:59:57:e3:cc:78:49:d0 atguigu@hadoop102
The key's randomart image is:
+--[ DSA 1024]----+
|             ..  |
|              .E |
|  . o   . .    o.|
|   o o + o    *.o|
|    o = S   ...* |
|     + * . o ..  |
|      o   o      |
|                 |
|                 |
+-----------------+
[atguigu@hadoop102 .ssh]$ ssh-copy-id hadoop103
/usr/bin/ssh-copy-id: ERROR: No identities found

再生成密钥对后,将其复制给另一台机器hadoop103时报错如下:

/usr/bin/ssh-copy-id: ERROR: No identities found

网上有提及到是因为没有生成密钥对的原因。

显然我不是该原因,后面提及如下:

 接着发现缺少公钥路径,通过 -i 加上即可:

$ ssh-copy-id -i ~/.ssh/id_dsa.pub user@remote_ip

我尝试之后,解决了

[atguigu@hadoop102 .ssh]$ ssh-copy-id -i ~/.ssh/id_dsa.pub atguigu@hadoop103
atguigu@hadoop103's password: 
Now try logging into the machine, with "ssh 'atguigu@hadoop103'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[atguigu@hadoop102 .ssh]$ ssh-copy-id -i ~/.ssh/id_dsa.pub atguigu@hadoop104
atguigu@hadoop104's password: 
Now try logging into the machine, with "ssh 'atguigu@hadoop104'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[atguigu@hadoop102 .ssh]$ ssh hadoop104
Last login: Fri Dec 28 03:39:18 2018 from 192.168.31.1
[atguigu@hadoop104 ~]$ exit
logout
Connection to hadoop104 closed.
[atguigu@hadoop102 .ssh]$ ssh hadoop103
Last login: Fri Dec 28 03:39:18 2018 from 192.168.31.1
[atguigu@hadoop103 ~]$ exit
logout
Connection to hadoop103 closed.

猜你喜欢

转载自blog.csdn.net/zuoyouzouzou/article/details/85306020