Below ismy script:
#!/usr/bin/perl -w use strict; use Net::SSH2::Perl; my $host = "10.160.12.26"; my $sshusername = "mktftp"; my $sshpasswd = "markdb"; print "Start\n"; my $ssh = Net::SSH2::Perl->new($host, debug => 1, protocol => 2); print "Before login\n"; my $loginStatus = $ssh->login($sshusername,$sshpasswd); print "After login\n"; my $command = "date"; my $stdout; my $stderr; my $exit; eval { ($stdout,$stderr,$exit) = $ssh->cmd($command); }; if ($@) { if ($@ =~ m/Permission denied/i) { print "Authentication failed\n"; exit 1; } } print "$stdout\n";
when I run it, show error:
Can't locate Net/SSH2/Perl.pm in @INC (you may need to i rl module) (@INC contains: C:/Strawberry/perl/site/lib C /lib C:/Strawberry/perl/lib .) at C:\\conn.pl line 4. BEGIN failed--compilation aborted at C:\\conn.pl line 4.
Could you please tell me why? I am trying to connect from Windows 7 to Linux
In reply to try to connect to Linux by digioleg54
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |