{"id":5932,"date":"2019-12-16T15:30:06","date_gmt":"2019-12-16T07:30:06","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=5932"},"modified":"2019-12-27T16:17:03","modified_gmt":"2019-12-27T08:17:03","slug":"pssh","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/pssh","title":{"rendered":"pssh\u547d\u4ee4 – \u6279\u91cf\u7ba1\u7406\u6267\u884c"},"content":{"rendered":"\n

pssh\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u8f6f\u4ef6\uff0c\u4f7f\u7528python\u5b9e\u73b0\uff0c\u7528\u4e8e\u6279\u91cfssh\u64cd\u4f5c\u5927\u6279\u91cf\u673a\u5668\uff1bpssh\u662f\u4e00\u4e2a\u53ef\u4ee5\u5728\u591a\u53f0\u670d\u52a1\u5668\u4e0a\u6267\u884c\u547d\u4ee4\u7684\u5de5\u5177\uff0c\u540c\u65f6\u652f\u6301\u62f7\u8d1d\u6587\u4ef6\uff0c\u662f\u540c\u7c7b\u5de5\u5177\u4e2d\u5f88\u51fa\u8272\u7684\uff1b\u6bd4\u8d77for\u5faa\u73af\u7684\u505a\u6cd5\uff0c\u6211\u66f4\u63a8\u8350\u4f7f\u7528pssh\uff01\u4f7f\u7528pssh\u7684\u524d\u63d0\u662f\uff1a\u5fc5\u987b\u5728\u672c\u673a\u4e0e\u5176\u4ed6\u670d\u52a1\u5668\u4e0a\u914d\u7f6e\u597d\u5bc6\u94a5\u8ba4\u8bc1\u8bbf\u95ee\uff08\u5373ssh\u4fe1\u4efb\u5173\u7cfb\uff09\u3002 <\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>pssh [\u53c2\u6570] [\u6587\u4ef6]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-h <\/td>\u6267\u884c\u547d\u4ee4\u7684\u8fdc\u7a0b\u4e3b\u673a\u5217\u8868\u6587\u4ef6  <\/td><\/tr>
-l <\/td>\u8fdc\u7a0b\u673a\u5668\u7684\u7528\u6237\u540d <\/td><\/tr>
-p <\/td>\u4e00\u6b21\u6700\u5927\u5141\u8bb8\u591a\u5c11\u8fde\u63a5 <\/td><\/tr>
-A <\/td>\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u5e76\u4e14\u628a\u5bc6\u7801\u4f20\u9012\u7ed9ssh\uff08\u6ce8\u610f\u8fd9\u4e2a\u53c2\u6570\u6dfb\u52a0\u540e\u53ea\u662f\u63d0\u793a\u4f5c\u7528\uff0c\u968f\u4fbf\u8f93\u5165\u6216\u8005\u4e0d\u8f93\u5165\u76f4\u63a5\u56de\u8f66\u90fd\u53ef\u4ee5\uff09 <\/td><\/tr>
-O <\/td>\u8bbe\u7f6essh\u53c2\u6570\u7684\u5177\u4f53\u914d\u7f6e\uff0c\u53c2\u7167ssh_config\u914d\u7f6e\u6587\u4ef6 <\/td><\/tr>
-x <\/td>\u4f20\u9012\u591a\u4e2aSSH \u547d\u4ee4\uff0c\u591a\u4e2a\u547d\u4ee4\u7528\u7a7a\u683c\u5206\u5f00\uff0c\u7528\u5f15\u53f7\u62ec\u8d77\u6765 <\/td><\/tr>
-X <\/td>\u540c-x \u4f46\u662f\u4e00\u6b21\u53ea\u80fd\u4f20\u9012\u4e00\u4e2a\u547d\u4ee4 <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u6279\u91cf\u6267\u884c\u547d\u4ee4:<\/p>\n\n\n\n

[root@linuxcool ~]# pssh -h hosts.txt -l root -i 'uptime'<\/pre>\n\n\n\n

\u5982\u679c\u6dfb\u52a0-A\u53c2\u6570\uff0c\u90a3\u4e48\u5373\u4f7f\u63d0\u524d\u505a\u4e86ssh\u4fe1\u4efb\u5173\u7cfb\uff0c\u8fd8\u662f\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801: <\/p>\n\n\n\n

[root@linuxcool ~]# pssh -h hosts.txt -l root -i -A 'uptime'<\/pre>\n","protected":false},"excerpt":{"rendered":"

pssh\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u8f6f\u4ef6\uff0c\u4f7f\u7528python\u5b9e\u73b0\uff0c\u7528\u4e8e\u6279\u91cfssh\u64cd\u4f5c\u5927\u6279\u91cf\u673a\u5668\uff1bpssh\u662f\u4e00\u4e2a\u53ef\u4ee5\u5728\u591a\u53f0\u670d\u52a1\u5668\u4e0a […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5932"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=5932"}],"version-history":[{"count":12,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5932\/revisions"}],"predecessor-version":[{"id":6171,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5932\/revisions\/6171"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=5932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=5932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=5932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}