in reply to ssh2 scp problem
My first guess would be that you are first changing to 'test/out' then trying to retrieve 'test/out/file'. It seems unlikely that there exists 'test/out/test/out/file'. I would try either not changing directories or just get 'file'. I am testing to see if I can reproduce, but that sounds the most likely.
UPDATE 1: Nevermind all that. I see now that you get a $sftp object and do the opendir on that, then return to $ssh2->scp_get. However, having said that, in my test environment, I get a core dump when I scp_get so I will need to find another test environment.
UPDATE 2: I have tried it on a 32bit arch instead of 64bit and it doesn't core dump. And, even better, it works fine to transfer the file. I copied your script and just changed $host, $user and $password and copied a test file in '~/test/out/' to 'aaa.txt'.
Does it appear that it is getting the sftp handle that isn't working, or the scp_get?
Can you SFTP and scp the files with the normal commands, not using perl?
Can you try it with debug enabled?
Maybe try this?
#!/usr/bin/perl use strict; use warnings; use Net::SSH2; my $host = ''; my $user = ''; my $password = ''; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); print "\nconnecting to $host...\n"; $ssh2->connect($host) or die $ssh2->error; print "\nauth to $host...\n"; $ssh2->auth_password($user,$password) or die $ssh2->error; printf "Auth OK: %s\n", $ssh2->auth_ok; print "scp get\n"; $ssh2->scp_get("test/out/Tesia220044-20081029175508-03.txt") or die $s +sh2->error; $ssh2->disconnect();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ssh2 open file problem
by llass61 (Novice) on Oct 31, 2008 at 18:18 UTC | |
by afresh1 (Hermit) on Oct 31, 2008 at 18:43 UTC | |
by llass61 (Novice) on Oct 31, 2008 at 20:12 UTC | |
by afresh1 (Hermit) on Oct 31, 2008 at 20:20 UTC |