开发者

Simultaneous Perl SSH Sessions

开发者 https://www.devze.com 2023-02-28 00:49 出处:网络
I am wondering if anyone has a Perl script (or can write one) to execute on multiple hosts at once via ssh, without any modules. I used to hav开发者_如何学Ce something like this but cannot find it now

I am wondering if anyone has a Perl script (or can write one) to execute on multiple hosts at once via ssh, without any modules. I used to hav开发者_如何学Ce something like this but cannot find it now and can't remember how it was done.


Are you looking for ClusterSSH? It's Perl, and it's used to run the same commands on several hosts at once, so this might be what you're looking for...


You might want to try using Expect.pm which is similar to @cnicutar's suggestion of calling an Expect script from Perl, except that you write it all in Perl. (This of course down not fit the requirement of "without any modules", but that requirement leads to bad Perl )


  1. Learn how to install and use modules even when you don't have admin privileges on the host
  2. Use Net::OpenSSH::Parallel


If you cannot use any additional modules from CPAN or any other source , all I can recommend you are:

1) Use Expect script and call it internally in your Perl script [Only if you are not willing to use Expect.pm module]

2) Use SSH keygen in all the servers to which you will connect to , so that password wont be necessary in the script. As mentioned by "cnicutar"

3) Use "remsh" if SSH usage is not that necessary.

0

精彩评论

暂无评论...
验证码 换一张
取 消