I wrote up some code to perform SFTP file downloads for my company.
It is now working for all but one of our clients that have chosen to use
this method.
But I need to get it working for ALL of them.
For the life of me I cannot figure out why it's not working for this one
machine.
Here's the info:
- I can sftp in perfectly fine from the command line.
- The client has this set right: PasswordAuthentication yes
- The code works for other servers perfectly fine.

Here is the code:
---------------------------------------
    my $ftp = undef;
    my $errors = undef;
    my %args;
    $args{'user'} = $user;
    $args{'password'} = $pass;
    $args{'debug'} = 'true';
    # Update where the connection should be looking
    # for the SFTP Known Hosts file.
    my %ssh_args;
    $ssh_args{'options'} = ["UserKnownHostsFile ".$config::sftp_hosts_file,
"RSAAuthentication yes", protocol=>'2,1'];
    $args{'ssh_args'} = \%ssh_args;

    # Make SFTP connection.
    eval {
        $ftp = Net::SFTP->new( $server, %args ) or $errors = 'Cannot connect
to SFTP Server.';
    };
    $errors = 'Cannot connect to SFTP Server. '.$@ if ($@);
-----------------------------------------

I then print out $errors and this is what i get:
"Cannot connect to SFTP Server. Permission denied at
/usr/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line 62"

Line 62 correlates with the login function in SFTP.pm:
        $ssh->login($param{user}, $param{password}, 'supress_shell');

I added the ", protocol=>'2,1'" bit per the suggestion of someone on some
forum for a similar problem.

Can anyone think of any other reason why this might be happening?
Thanks.
--Alex

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to