[Ssh-sftp-perl-users] NET::SFTP Connectivity Failure
Brought to you by:
dbrobins
From: Moussavi, K. <KMo...@PE...> - 2004-02-03 23:13:05
|
Hello, We are trying to use the Net::SFTP perl module to transfer one file from a remote machine. Here is the code we're using: ########################################### use Net::SFTP; $user = "root"; $passwd = "testpass"; $ip = "xxx.xxx.xxx.xxx"; my $sftp = undef; eval{ $sftp = Net::SFTP->new($ip, user=>$user, password=>$passwd, debug=>3 ); }; print "sftp = $sftp\n"; if (! $sftp) { print "I can't connect!\n"; }else{ print "SUCCESS!\n"; } $sftp->get($remoteFile, $localFile); ########################################### I get the following error: ########################################### [root@MGWConfigServer scripts.d]# ./getConfig.pl Remote file =/usr/axxxxxxxx-9-backupfile.tar Local file = /home/MGW-configs/axxxxxxxxx/9/axxxxxxxxx-9-backupfile.tar MGWConfigServer: Reading configuration data /root/.ssh/config MGWConfigServer: Reading configuration data /etc/ssh_config MGWConfigServer: Allocated local port 1022. MGWConfigServer: Connecting to xxx.xxx.xxx.xxx, port 22. MGWConfigServer: Remote protocol version 1.99, remote software version OpenSSH_3.5p1 MGWConfigServer: Net::SSH::Perl Version 1.23, protocol version 2.0. MGWConfigServer: No compat match: OpenSSH_3.5p1. MGWConfigServer: Connection established. MGWConfigServer: Sent key-exchange init (KEXINIT), wait response. MGWConfigServer: Algorithms, c->s: 3des-cbc hmac-sha1 none MGWConfigServer: Algorithms, s->c: 3des-cbc hmac-sha1 none MGWConfigServer: Entering Diffie-Hellman Group 1 key exchange. MGWConfigServer: Sent DH public key, waiting for reply. sftp = I can't connect! Can't call method "get" on an undefined value at <line in script>.... [root@xxxxxServer scripts.d]# ####################################### Any assistance in resolving this matter is highly appreciated. The value of $sftp is blank. Keyvan |