hey guys i have been killing myself over this problem. i am able to scp
regulary but i cant using net::stftp hopefully the below is self
explainatory enough, the remote system is a netscreen firewall. (users/ips
have been changed)
CODE:
print "\t\t\t \[Device $devcount of " . @ip . "\]\n";
print "\t\t-->Grabbing ns_sys_config\n";
# Previous Try
# my $sftp =3D Net::SFTP->new($ip[$x], user=3D>$sshuser, pass=3D>$sshpass,
debug=3D>'true', ssh_args =3D> [ protocol =3D> 2 , options =3D>
['PasswordAuthentication yes','PreferredAuthentications password']]);
my $sftp =3D Net::SFTP->new($ip[$x], user=3D>$sshuser, password=3D>$sshpass=
,
debug=3D>'true');
my $remote =3D "file";
my $local =3D "$scripttmp/$date-$ip[$x]-netscreen.config";
$sftp->get($remote,$local);
#######################PERL SCRIPT START################
scriptuser@linux:~/$ perl script.pl
Hostname : host
IP: 192.168.x.x
[Device 1 of 1]
-->Grabbing file
linux: Reading configuration data /home/scriptuser/.ssh/config
linux: Reading configuration data /etc/ssh_config
linux: Connecting to 192.168.x.x, port 22.
linux: Remote protocol version 2.0, remote software version NetScreen
linux: Net::SSH::Perl Version 1.29, protocol version 2.0.
Linux: No compat match: NetScreen
linux: Connection established.
linux: Sent key-exchange init (KEXINIT), wait response.
linux: Algorithms, c->s: 3des-cbc hmac-sha1 none
linux: Algorithms, s->c: 3des-cbc hmac-sha1 none
linux: Entering Diffie-Hellman Group 1 key exchange.
linux: Sent DH public key, waiting for reply.
linux: Received host key, type 'ssh-dss'.
linux: Host '192.168.x.x' is known and matches the host key.
linux: Computing shared secret key.
linux: Verifying server signature.
linux: Waiting for NEWKEYS message.
linux: Enabling incoming encryption/MAC/compression.
linux: Send NEWKEYS, enable outgoing encryption/MAC/compression.
linux: Sending request for user-authentication service.
linux: Service accepted: ssh-userauth.
linux: Trying empty user-authentication request.
linux: Authentication methods that can continue: .
Permission denied at /usr/lib/perl5/site_perl/5.8.6/Net/SFTP.pm line 62
#######################PERL SCRIPT STOP#######################
#######################SCP START###########################
scriptuser@linux:~/$ scp -v user@192.168.x.x:file file
Executing: program /usr/bin/ssh host 192.168.x.x, user user, command scp -v
-f file
OpenSSH_3.9p1, OpenSSL 0.9.7e 25 Oct 2004
debug1: Reading configuration data /home/scriptuser/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.x.x [192.168.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/scriptuser/.ssh/identity type -1
debug1: identity file /home/scriptuser/.ssh/id_rsa type -1
debug1: identity file /home/scriptuser/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version NetScreen
debug1: no match: NetScreen
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.9p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client 3des-cbc hmac-sha1 none
debug1: kex: client->server 3des-cbc hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host '192.168.x.x' is known and matches the DSA host key.
debug1: Found key in /home/scriptuser/.ssh/known_hosts2:14
debug1: ssh_dss_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue:
debug1: Next authentication method: publickey
debug1: Trying private key: /home/scriptuser/.ssh/identity
debug1: Trying private key: /home/scriptuser/.ssh/id_rsa
debug1: Trying private key: /home/scriptuser/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue:
debug1: Next authentication method: password
user@192.168.x.x's password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: scp -v -f ns_sys_config
Sink: C0644 29836 file
file
100% 29KB 29.1KB/s 00:01
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.9 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status -1
#######################SCP STOP##############################
<scriptuser@neteng01-1ne:~/scripts/netscreen$>
<scriptuser@neteng01-1ne:~/scripts/netscreen$>
|