linux-解决/usr/bin/which: no ssh-copy-id in 和ssh: Could not resolve hostname问题

使用yum install openssh-clients  安装命令

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

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

这时有报错了

[root@node2 ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub node1
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.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: ERROR: ssh: Could not resolve hostname node1: Name or service not known

这是因为没有解析主机名

[root@node2 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.96 node1
192.168.1.108 node2
192.168.1.109 node3

ping node1

[root@node3 ~]# ping node1
PING node1 (192.168.1.96) 56(84) bytes of data.
64 bytes from node1 (192.168.1.96): icmp_seq=1 ttl=64 time=1.36 ms
64 bytes from node1 (192.168.1.96): icmp_seq=2 ttl=64 time=0.336 ms
64 bytes from node1 (192.168.1.96): icmp_seq=3 ttl=64 time=0.441 ms
64 bytes from node1 (192.168.1.96): icmp_seq=4 ttl=64 time=0.579 ms
64 bytes from node1 (192.168.1.96): icmp_seq=5 ttl=64 time=0.505 ms

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值