ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

/usr/bin/which: no ssh-copy-id in 和ssh: Could not resolve hostname

2019-07-16 13:35:53  阅读:202  来源: 互联网

标签:bin resolve 0.20 192.168 abc ssh root id


报错详情如下:

 

[root@ceshi .ssh]# which ssh-copy-id
/usr/bin/which: no ssh-copy-id in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@ceshi ~]# ssh-copy-id-i.ssh/id_rsa root@192.168.0.20
-bash: ssh-copy-id-i.ssh/id_rsa: 没有那个文件或目录

使用yum install openssh-clients  安装命令

有的系统没有此命令 有的系统缺省 就包含这一条命令!

但是我的测试机没有发现此命令 只能这样安装!

这时有报错了

[root@ceshi .ssh]# ssh-copy-id -i ./id_rsa root@192.168.0.20
ssh: Could not resolve hostname ./id_rsa: Name or service not known

这是因为没有解析主机名

[root@puttet ~]# hostname
abc
[root@ceshi .ssh]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.19 ceshi
192.168.0.20 abc
[root@ceshi .ssh]# ping abc
PING abc (192.168.0.20) 56(84) bytes of data.
64 bytes from abc (192.168.0.20): icmp_seq=1 ttl=64 time=0.322 ms
64 bytes from abc (192.168.0.20): icmp_seq=2 ttl=64 time=0.270 ms
^C
--- abc ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1300ms
rtt min/avg/max/mdev = 0.270/0.296/0.322/0.026 ms

 

这样就可以了

[root@ceshi .ssh]# ssh-copy-id -i ./id_rsa.pub  root@192.168.0.20
The authenticity of host '192.168.0.20 (192.168.0.20)' can't be established.
RSA key fingerprint is 7b:a4:ae:42:50:8b:27:82:1c:dc:66:a9:5a:cb:67:a2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.20' (RSA) to the list of known hosts.
root@192.168.0.20's password:
Now try logging into the machine, with "ssh 'root@192.168.0.20'", and check in:
  .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.

ok 可以使用了!

[root@puttet ~]# cd .ssh/authorized_keys

标签:bin,resolve,0.20,192.168,abc,ssh,root,id
来源: https://blog.csdn.net/zhouchuan152/article/details/95870934

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有