"....Are you sure you have the correct protocol? Are you actually usin
+g SSH? "
Erm, all I know is that I use a Putty session to connect (via port 22, I've just checked it). I enter user= root and the password and hey presto I am in. I want to do just this is in a script!
Anyway this is what I've tried
use Net::SSH qw(sshopen2);
use strict;
my $user = "root";
my $host = "149.195.49.155";
my $cmd = "ls -l";
sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!";
while (<READER>) {
chomp();
print "$_\n";
}
close(READER);
close(WRITER);
And this is what I got!!:
C:\Scripts>esx_conn3.pl
'ssh' is not recognized as an internal or external command,
operable program or batch file.
An example code would be great.
Does this help? Cheers.
|