in reply to getcwd failed
The Net::SSH::Perl script:#!/usr/bin/perl use strict; use warnings; use Cwd; my $dir = getcwd; print $dir, "\n";
#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; use constant { HOST => 'localhost', USER => 'user', PASSWORD => 'password', }; my $ssh = Net::SSH::Perl->new( HOST, port => 22 || 'ssh', protocol => 2, debug => 1, ); $ssh->login(USER, PASSWORD); my ($stdout, $stderr, $exit) = $ssh->cmd( 'perl /root/Desktop/cwd.pl'); print $stdout, "\n"; exit;
|
|---|