coglesby has asked for the wisdom of the Perl Monks concerning the following question:
I read everything I could find on here pertaining to this problem but can't find what I'm looking for so any help is appreciated! Below is the code I am trying to run:# queueing msg len: 5, code:1, id:3 ... [1] 00 00 00 05 01 00 00 00 03 + | ......... # waiting for message... [1] connection failed: bad remote message received
use Net::SFTP::Foreign ; $Net::SFTP::Foreign::debug = 25; sub mget { my($mysftp) = shift; my($filename) = shift; my($remote_path) = shift ; my($local_path) = shift ; my $ls = $mysftp->ls(); chop $filename; foreach $ls (@$ls) { if ($ls->{filename} =~ m/$filename/) { $mysftp->get($ls->{filename}, $local_path . $ls->{filename}) or wa +rn $mysftp->error; } } } my($sftp) ; # sftp object variable my($myhost) ; # hostname to connect to my($myuser) ; my($mypass) ; my($myremotedir) ; my($mylocaldir) ; my($myfilename) ; my($parameterfile) ; if ($#ARGV != 0) { die "usage: $ARGV[-1] <parameter filename>\n $ARGV[0] --help + for parameter file layout\n"; } if ($ARGV[0] eq "--help") { printf "usage: $ARGV[-1] <parameter filename>\n" ; printf " parameter file layout:\n" ; printf "<host>\n" ; printf "<login>\n" ; printf "<password>\n" ; printf "<remote_path>\n" ; printf "<local_path>\n" ; printf "<filename/mask>\n\n" ; exit() ; } $parameterfile = $ARGV[0] ; open (PARMFILE, $parameterfile) || die "couldn't open parameter file $ +parameterfile!\n" ; $myhost = <PARMFILE> ; $myuser = <PARMFILE> ; $mypass = <PARMFILE> ; $myremotedir = <PARMFILE> ; $mylocaldir = <PARMFILE> ; $myfilename = <PARMFILE> ; close(PARMFILE) ; chomp($myhost); chomp($myuser); chomp($mypass); chomp($myremotedir); chomp($mylocaldir); chomp($myfilename); if (substr($mylocaldir, -1) ne "/") { $mylocaldir .= "/" ; } $sftp = Net::SFTP::Foreign->new($myhost, user => $myuser, password => +$mypass, more => '-v' ); $sftp->error and die "connection failed: " . $sftp->error(); print "sftp-status = " . $sftp->status(); mget($sftp,$myfilename,$myremotedir,$mylocaldir) ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't connect using Password with Net::SFTP::Foreign
by frieduck (Hermit) on May 01, 2009 at 01:51 UTC | |
|
Re: Can't connect using Password with Net::SFTP::Foreign
by salva (Canon) on May 01, 2009 at 09:13 UTC | |
by Anonymous Monk on May 01, 2009 at 23:28 UTC | |
by coglesby (Initiate) on May 04, 2009 at 13:57 UTC | |
by salva (Canon) on May 04, 2009 at 15:26 UTC | |
by coglesby (Initiate) on May 04, 2009 at 15:32 UTC | |
|