in reply to Re: Net::SFTP::Foreign is slow
in thread Net::SFTP::Foreign is slow

Thanks Rob for your help. I have installed "Net-SFTP-Foreign-Backend-Net_SSH2" and modified the code as below, but getting this error, please guide if I have done something wrong.
use Net::SFTP::Foreign; my $sftp = Net::SFTP::Foreign->new( host => 'delivery.myserver.com', port => '22', backend => 'Net_SSH2', user => 'ftp_user', more => [qw(-i mytransaction.private.key.ppk)], ssh_cmd => 'plink'); $sftp->die_on_error("Unable to establish SFTP connection");
error is "Invalid options 'ssh_cmd', 'more' or bad combination of options at sftp.pl line 2"

Replies are listed 'Best First'.
Re^3: Net::SFTP::Foreign is slow
by salva (Canon) on Jul 12, 2011 at 08:58 UTC
    syphilis is right, you can't use more or ssh_cmd with the Net_SSH2 backend.

    Do as follows:

    use Net::SFTP::Foreign 1.67; use Net::SFTP::Foreign::Backend::Net_SSH2 0.04; my $sftp = Net::SFTP::Foreign->new( host => 'delivery.myserver.com', port => '22', backend => 'Net_SSH2', user => 'ftp_user', key_path => "mytransaction.private +.key"); $sftp->die_on_error("Unable to establish SFTP connection");
    You will probably have to convert the private key from PuTTY to OpenSSH format and place the public key in the same directory with the .pub suffix.

      Hi Rob,

      I am getting an error "Invalid option 'key_path' or bad combination of options". Can you please advise.

      use Net::SFTP::Foreign 1.67; use Net::SFTP::Foreign::Backend::Net_SSH2 0.04; my $sftp = Net::SFTP::Foreign->new( host => 'delivery.myserver.com', port => '22', backend => 'Net_SSH2', user => 'ftp_user', key_path => "mytransaction.private +.key"); $sftp->die_on_error("Unable to establish SFTP connection");
        There was a bug on Net::SFTP::Foreign::Backend::Net_SSH2 0.04.

        Get the new 0.05 I have just uploaded to CPAN or just use privatekey instead of key_path:

        my $sftp = Net::SFTP::Foreign->new( host => 'delivery.myserver.com', port => '22', backend => 'Net_SSH2', user => 'ftp_user', privatekey => "mytransaction.priva +te.key");

      Hi Selva,

      Foreign 1.67 and Net_SSH2 0.04 is not available under PPM and seems to be Foreign 1.65 and Net_SSH2 0.03 does not support the method you have advised. can you please guide me how to install those versions in Windows environment. Thanks for your valuable help.

        Foreign 1.67 and Net_SSH2 0.04 is not available under PPM

        The sisyphusion ppm repo has now been updated to versions 1.67 and 0.04 respectively. (Net::SSH2 has also been updated to 0.38 - was at 0.35.)

        Cheers,
        Rob
Re^3: Net::SFTP::Foreign is slow
by syphilis (Archbishop) on Jul 12, 2011 at 04:22 UTC
    Invalid options 'ssh_cmd', 'more' or bad combination of options at sftp.pl line 2

    It may be that the 'more' and 'ssh_cmd' options don't work on Windows - I'm almost certain 'more' doesn't work. If salva drops by (as he usually does) he would be able to give you more definitive advice.
    I've only ever used this module for 'get', 'put', 'del', 'ls' and maybe a couple of other commands that I can't recall at the moment. For those purposes I've found it to be excellent.

    Cheers,
    Rob