{"id":193083,"date":"2020-06-04T09:33:27","date_gmt":"2020-06-04T01:33:27","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=193083"},"modified":"2020-06-02T11:34:41","modified_gmt":"2020-06-02T03:34:41","slug":"centos-pssh","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-pssh.html","title":{"rendered":"Centos7\u90e8\u7f72\u8f7b\u91cf\u7ea7\u81ea\u52a8\u5316\u8fd0\u7ef4\u5de5\u5177pssh"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\npssh\u662f\u7531python\u7f16\u5199\uff0c\u53ef\u4ee5\u5728\u591a\u53f0\u670d\u52a1\u5668\u6267\u884c\u547d\u4ee4\u7684\u5de5\u5177\u3002\u5728\u670d\u52a1\u5668\u8d8a\u6765\u8d8a\u591a\u7684\u4f01\u4e1a\u8fd9\u79cd\u81ea\u52a8\u5316\u8fd0\u7ef4\u5de5\u5177\u8d8a\u6765\u8d8a\u706b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u4e0b\u8f7dpssh\u5b89\u88c5\u5305<\/strong><\/div>\n
[root@localhost ~]# wget https:\/\/files.pythonhosted.org\/packages\/60\/9a\/8035af3a7d3d1617ae2c7c174efa4f154e5bf9c24b36b623413b38be8e4a\/pssh-2.3.1.tar.gz\r\n<\/pre>\n
\u5b89\u88c5\u4f9d\u8d56\u5305<\/strong><\/div>\n
[root@localhost ~]# yum install -y make gcc gcc++ python-devel python-pip<\/pre>\n
\u5b89\u88c5pssh<\/strong><\/div>\n
[root@localhost ~]# tar xf pssh-2.3.1.tar.gz\r\n[root@localhost ~]# cd pssh-2.3.1\r\n[root@localhost ~]# python setup.py install<\/pre>\n
\u914d\u7f6e\u514d\u5bc6\u767b\u5f55<\/strong><\/div>\n
[root@localhost ~]# ssh-keygen\r\nGenerating public\/private rsa key pair.\r\nEnter file in which to save the key (\/root\/.ssh\/id_rsa): \r\nEnter passphrase (empty for no passphrase): \r\nEnter same passphrase again: \r\nYour identification has been saved in \/root\/.ssh\/id_rsa.\r\nYour public key has been saved in \/root\/.ssh\/id_rsa.pub.\r\nThe key fingerprint is:\r\nSHA256:3antaxjGw+hdgfSlrXLYhUe5vgHe9b0ehh\/gUY9E8Eg root@localhost.localdomain\r\nThe key's randomart image is:\r\n+---[RSA 2048]----+\r\n|            E... |\r\n|          .. ++  |\r\n|         . o.*oo |\r\n|         ...*o*.o|\r\n|        S+.+o@..+|\r\n|        . OoB B o|\r\n|       . o.B.o *.|\r\n|        . o.. +.o|\r\n|           .o..o |\r\n+----[SHA256]-----+\r\n[root@localhost ~]# cd \/root\/.ssh\/\r\n[root@localhost .ssh]# ls\r\nid_rsa  id_rsa.pub\r\n[root@localhost .ssh]# ssh-copy-id 172.16.1.112\r\n\/usr\/bin\/ssh-copy-id: INFO: Source of key(s) to be installed: \"\/root\/.ssh\/id_rsa.pub\"\r\nThe authenticity of host '172.16.1.112 (172.16.1.112)' can't be established.\r\nECDSA key fingerprint is SHA256:yFvaxR1x5YDhhe+6xR\/Ou6Sm+YPYvPAoiLVKt9mAnXA.\r\nECDSA key fingerprint is MD5:0d:c4:79:bc:36:7a:a4:82:95:4f:d5:d0:a3:c8:7d:2e.\r\nAre you sure you want to continue connecting (yes\/no)? yes\r\n\/usr\/bin\/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed\r\n\/usr\/bin\/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys\r\nroot@172.16.1.112's password: \r\n\r\nNumber of key(s) added: 1\r\n\r\nNow try logging into the machine, with:   \"ssh '172.16.1.112'\"\r\nand check to make sure that only the key(s) you wanted were added.\r\n[root@localhost .ssh]# ssh-copy-id 172.16.1.16\r\n\/usr\/bin\/ssh-copy-id: INFO: Source of key(s) to be installed: \"\/root\/.ssh\/id_rsa.pub\"\r\nThe authenticity of host '172.16.1.16 (172.16.1.16)' can't be established.\r\nECDSA key fingerprint is SHA256:ANzlXzrGA87YLI2vzkPJ\/iNPiSQ5JStJc95948jE8aw.\r\nECDSA key fingerprint is MD5:f9:f1:1b:5a:99:64:d8:d8:e9:9b:e6:bb:c3:d5:bd:e7.\r\nAre you sure you want to continue connecting (yes\/no)? yes\r\n\/usr\/bin\/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed\r\n\/usr\/bin\/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys\r\nroot@172.16.1.16's password: \r\n\r\nNumber of key(s) added: 1\r\n\r\nNow try logging into the machine, with:   \"ssh '172.16.1.16'\"\r\nand check to make sure that only the key(s) you wanted were added.<\/pre>\n
\u6d4b\u8bd5\u514d\u5bc6\u767b\u5f55<\/strong><\/div>\n
[root@localhost ~]# ssh 172.16.1.112\r\nLast login: Tue Jun  2 09:44:24 2020 from 172.16.1.16\r\n[root@localhost ~]# ssh 172.16.1.16\r\nLast login: Tue Jun  2 09:30:47 2020 from 172.16.1.100<\/pre>\n
\u6d4b\u8bd5pssh<\/strong><\/div>\n
\u521b\u5efaaaa\u6587\u4ef6\u5b58\u653eip\u5730\u5740<\/strong><\/span><\/div>\n
[root@localhost ~]# cat aaa\r\n172.16.1.16\r\n172.16.1.112\r\n<\/pre>\n
\u6279\u91cf\u6267\u884cdate\u547d\u4ee4<\/strong><\/span><\/div>\n
[root@localhost ~]# pssh -h aaa -l root -P \"date\"\r\n172.16.1.16: 2020\u5e74 06\u6708 02\u65e5 \u661f\u671f\u4e8c 09:59:48 CST\r\n[1] 09:59:48 [SUCCESS] 172.16.1.16\r\n172.16.1.112: 2020\u5e74 06\u6708 02\u65e5 \u661f\u671f\u4e8c 09:59:48 CST\r\n[2] 09:59:48 [SUCCESS] 172.16.1.112<\/pre>\n
\u67e5\u770b\u78c1\u76d8<\/strong><\/span><\/div>\n
[root@localhost ~]# pssh -h aaa -l root -P \"lsblk\"\r\n172.16.1.16: NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\r\nsda               8:0    0   20G  0 disk \r\n\u251c\u2500sda1            8:1    0    1G  0 part \/boot\r\n\u2514\u2500sda2            8:2    0   19G  0 part \r\n  \u251c\u2500centos-root 253:0    0   17G  0 lvm  \/\r\n  \u2514\u2500centos-swap 253:1    0    2G  0 lvm  [SWAP]\r\nsr0              11:0    1  4.2G  0 rom  \r\n[1] 10:13:02 [SUCCESS] 172.16.1.16\r\n172.16.1.112: NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\r\nsda               8:0    0   20G  0 disk \r\n\u251c\u2500sda1            8:1    0    1G  0 part \/boot\r\n\u2514\u2500sda2            8:2    0   19G  0 part \r\n  \u251c\u2500centos-root 253:0    0   17G  0 lvm  \/\r\n  \u2514\u2500centos-swap 253:1    0    2G  0 lvm  [SWAP]\r\nsr0              11:0    1  4.2G  0 rom  \r\n[2] 10:13:03 [SUCCESS] 172.16.1.112\r\n\r\n<\/pre>\n

pssh\u90e8\u7f72\u5b8c\u6bd5\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

[root@localhost ~]# wget https:\/\/files.pythonhosted.org […]<\/p>\n","protected":false},"author":1469,"featured_media":193096,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-193083","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=193083"}],"version-history":[{"count":14,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193083\/revisions"}],"predecessor-version":[{"id":193108,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193083\/revisions\/193108"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/193096"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=193083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=193083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=193083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}