Reputation: 43
I want to create an SSH session to a remote machine using Perl, and execute commands automatically from a Windows machine. Is there a way I can do that?
Upvotes: 0
Views: 1485
Reputation: 126742
The Net::SSH
module relies on a command-line ssh
tool, which Windows doesn't have straight from the box.
I suggest you use Putty's plink
command instead of putty
itself, as plink
is much closer to an ssh
command-line utility and is intended for this sort of thing. Together with IPC::Open3
(or IPC::Open2
if you're not interested in seeing the output to STDERR) it will let you print
commands and and readline
the responses interactively. I am sure you can create your own log files.
Alternatively you could consider Net::SSH::W32Perl
, which is a compatibility layer around Net::SSH::Perl
. It is rather old but should be better than relying on Putty.
Upvotes: 2