1 #!/usr/bin/perl -IOpen-ILS/src/perlmods
3 use strict; use warnings;
11 remote_host => 'example.org',
12 remote_user => 'some_user',
13 remote_password => 'whatever',
16 $config{remote_file} = '/home/' . $config{remote_user};
18 my $x = Net::SSH2->new();
20 $x->connect($config{remote_host}) or die "Could not connect to $config{remote_host}: " . $x->error;
22 publickey => '/home/opensrf/.ssh/id_rsa.pub',
23 privatekey => '/home/opensrf/.ssh/id_rsa',
24 username => $config{remote_user},
25 # password => $config{remote_password},
26 rank => [ qw/ publickey hostbased password / ],
27 ) or die "Auth failed for $config{remote_host}: " . $x->error;
29 print "Reading directory: $config{remote_file}\n";
31 my $dir = $sftp->opendir($config{remote_file}) or die $sftp->error;
33 print "Directory listing:\n";
35 while (my $line = $dir->read()) {
36 printf "%3s)\n", ++$i;
37 foreach (sort keys %$line) {
38 printf " %20s => %s\n", $_, $line->{$_};