in reply to How to connect to remote machine
The synopsis in Net::SSH2 gives an example of what you want to do.
# Shamelessly cut and paste from said synopsis;) use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('example.com') or die; if ($ssh2->auth_keyboard('fizban')) { my $chan = $ssh2->channel(); $chan->exec('program'); my $sftp = $ssh2->sftp(); my $fh = $sftp->open('/etc/passwd') or die; print $_ while <$fh>; }
|
|---|