in reply to Re^2: NET::SFTP::Foreign in perl
in thread NET::SFTP::Foreign in perl

There was a regression on Net::SFTP::Foreign 1.53.

The problem is solved in the new version 1.54_01 that I have just uploaded to CPAN.

Replies are listed 'Best First'.
Re^4: NET::SFTP::Foreign in perl
by Anonymous Monk on Jul 28, 2009 at 12:56 UTC
    Dear Salva, Is there any way I can use Net::SFTP::Foreign (version 1.54) to connect to remote machine and then execute a shell script or any other command on the remote machine.

    I tried
    my $sftp = Net::SFTP::Foreign->new('user@10.21.1.176', password => $pass, open2_cmd => 'mkdir perl_sftp');

    But it gave me an error
    - Invalid option 'host' or bad combination of options at sftpCompatEx.pl line 21

    thanks
      No, the SFTP protocol does not allow arbitrary execution of commands on the remote side.

      My other module Net::OpenSSH, that integrates nicely with Net::SFTP::Foreign would allow you to do so. It needs a recent OpenSSH client and only works on Linux/Unix.

      Another options are Net::SSH2 (not completely stable yet) and Net::SSH::Perl.

      update: BTW, you can not run arbitrary commands on the remote side but you can create directories if that is all you want:

      $sftp->mkdir('/foo/bar');
      That option runs a command on the local machine. You want to use SSH to run commands on the remote machine, not SFTP.

      Update: salva is right though, SFTP does do mkdir

        Thanks for the info
Re^4: NET::SFTP::Foreign in perl
by Anonymous Monk on Jul 22, 2009 at 11:48 UTC
    Thanks a lot!