欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

centos6.5配置ssh免秘钥登陆执行pssh命令的讲解

程序员文章站 2022-06-02 12:54:43
1.检查并安装pssh,yum list pssh 2.因为没有配置免秘钥登陆,pssh命令执行失败。 [root@bogon ]# pssh -h root@...

1.检查并安装pssh,yum list pssh

2.因为没有配置免秘钥登陆,pssh命令执行失败。

[root@bogon ]# pssh -h root@192.168.245.129 -i uptime
[1] 11:00:36 [failure] root@192.168.245.129 exited with error code 255
stderr: the authenticity of host '192.168.245.129 (192.168.245.129)' can't be established.
rsa key fingerprint is 84:2d:70:33:1c:45:fa:e6:4b:94:72:7e:10:98:7c:a8.
are you sure you want to continue connecting (yes/no)? 
host key verification failed.

3.生成秘钥。

[root@bogon tmp]# ssh-keygen -t rsa
generating public/private rsa key pair.
enter file in which to save the key (/root/.ssh/id_rsa): 
enter passphrase (empty for no passphrase): 
enter same passphrase again: 
your identification has been saved in /root/.ssh/id_rsa.
your public key has been saved in /root/.ssh/id_rsa.pub.
the key fingerprint is:
9e:14:9a:cc:8d:9b:fd:51:c5:68:24:e1:ce:c6:d7:33 root@bogon
the key's randomart image is:
+--[ rsa 2048]----+
|     o..  |
|     . o o  |
|    . . o o |
|   o = = . o  |
|   * s = o e |
|    * o o  o |
|   o + .   |
|     . .   |
|     .   |
+-----------------+
[root@bogon .ssh]# ll
total 8
-rw------- 1 root root 1675 aug 22 11:06 id_rsa
-rw-r--r-- 1 root root 392 aug 22 11:06 id_rsa.pub

4.拷贝到被管对象。

[root@bogon .ssh]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.245.129
the authenticity of host '192.168.245.129 (192.168.245.129)' can't be established.
rsa key fingerprint is 84:2d:70:33:1c:45:fa:e6:4b:94:72:7e:10:98:7c:a8.
are you sure you want to continue connecting (yes/no)? yes
warning: permanently added '192.168.245.129' (rsa) to the list of known hosts.
reverse mapping checking getaddrinfo for bogon [192.168.245.129] failed - possible break-in attempt!
root@192.168.245.129's password: 
now try logging into the machine, with "ssh 'root@192.168.245.129'", and check in:
 .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.

5.pssh命令执行成功。

[root@bogon .ssh]# pssh -h root@192.168.245.129 -i uptime
[1] 11:10:39 [success] root@192.168.245.129
 20:10:39 up 2:07, 1 user, load average: 0.00, 0.00, 0.00

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接