Unless you are forced to by old servers and software, dump Net::Sftp and Net::SSH::Perl. They are antiquated and prone to problems. Use Net::SSH2 if you can, here is a primer->A little demo for Net::SSH2
| [reply] |
jhs3,
If you want to know what modules are part of the core, then use Module::CoreList. In addition to those modules, certain distributions include additional modules such as ActiveState Perl on Win32.
With regards to installing modules, there are far too many links for me to write in this small margin. You may want to look into CPAN, CPANPLUS, apt-get, PPM, etc.
| [reply] |
try (the development version of) Net::SFTP::Foreign!
It doesn't require any other module, just the SSH client installed on your systems. | [reply] |
Net::SSH::Perl, Net::SFTP and even Net::SSH2 are very problematic to install and are painfully and, in many cases, unusably slow on modern hardware. i haven't tried Net::SFTP::Foreign, so maybe give that a go like was said.
then again, there are other ways as well - open() as a pipe w/ pki for auth works, or even Expect :) both assume local ssh install.
joining ssh-sftp-perl-users@lists.sourceforge.net and reviewing the archives for some of the issues you might run into couldn't hurt ether. good luck! | [reply] |
On www.perl.com, it seems that the latest stable version of Perl is 5.5.8.
I think you meant 5.8.8.
So, does the latest version of Perl - 5.5.8
Likewise.
| [reply] |
As far as I know Net::SFTP and Net::SSH::Perl are not part of the core.
From my experience installing Net::SSH::Perl is a bit tedious. Install the prerequisite modules beforehand (at least those having Math namespace) thus you avoid possible hurdles with complex dependencies.
I use Net::SSH::Perl on Solaris OSs without any issues.
| [reply] |
Here's what I had to do to install Net::SSH::Perl in my Windows ActivePerl 5.6.1 environment:
1. Use PPM3 to set the proper repository and install net-ssh-perl
ppm> rep add "U of Winnipeg" http://theoryx5.uwinnipeg.ca/ppms/package.xml
ppm> install net-ssh-perl -force –follow
2. Get Math-GMP-2.04 from CPAN.org and untar it. Build fails due to missing 'gmp.h' and 'gmp.lib' files, so you have to build 'em.
3. Get GMP from http://cs.nyu.edu/exact/core/gmp/ and follow instructions to build based on how your version of ActivePerl was built. My ActivePerl 5.6.1 was built using Microsoft VC, with ccflags including '-MD', so I followed the instructions for building GMP using this compiler, changing Project…Settings…C/C++…Project Options to use /MD instead of /ML. The build completes with 0 Erros and 132 Warnings.
4. Copy the resulting gmp.h and gmp.lib to the untarred Math-GMP-2.04 directory. Then build Math-GMP-2.04 using the standard Makefile.PL...nmake...nmake test...nmake install process.
5. Edit <perl>/site/lib/Net/SSH/Perl.pm and comment out these lines if you get the "Can't set socket non-blocking" error message:
# defined($sock->blocking(0))
# or die "Can't set socket non-blocking: $!";
Here's a test script you can use:
use Getopt::Std;
use Net::SSH::Perl;
&getopts('h:u:p:');
&Usage( ) unless( defined($opt_h) && defined($opt_u) && defined($opt_p
+) );
$ssh = Net::SSH::Perl->new( $opt_h, port => 22 );
$ssh->login( $opt_u, $opt_p );
while( 1 )
{
print "$opt_h\> ";
$cmd = <STDIN>;
$cmd =~ s/^\s+|\s+$//g;
last if( $cmd eq "" );
($stdout, $stderr, $exit_code) = $ssh->cmd($cmd);
if( $exit_code ) { print $stderr; }
else { print $stdout; }
}
exit( 0 );
sub Usage
{
print “Usage: $0 -h <host> -u <user> -p <password>\n”;
exit( 0 );
} # end of Usage
HTH,
Dean Leonard
| [reply] [d/l] |