#!/usr/bin/perl -w #use strict; use warnings; use Net::SFTP; my $server="XXXXXXXX"; my %args = (ssh_args => { identity_files => [ "/XXXXXXXXXX" ],debug => 2, } ); $args{debug} = 1; $args{user} = "XXXXXXXX"; my $sftp=Net::SFTP->new($server, %args); $sftp->ls("." , sub { print $_[0]->{longname}, "\n" }); $sftp->put("helloabc.txt", "helloabc.txt"); $sftp->get("S1H62009.txt", "S1H62009.txt"); exit; #### AZLDBNJISNDM01: Reading configuration data /home/batchusr/.ssh/config AZLDBNJISNDM01: Reading configuration data /etc/ssh_config AZLDBNJISNDM01: Connecting to XXXXXXX, port 22. AZLDBNJISNDM01: Remote version string: SSH-2.0-WS_FTP-SSH_8.6.1.1504 AZLDBNJISNDM01: Remote protocol version 2.0, remote software version WS_FTP-SSH_8.6.1.1504 AZLDBNJISNDM01: Net::SSH::Perl Version 2.14, protocol version 2.0. AZLDBNJISNDM01: No compat match: WS_FTP-SSH_8.6.1.1504. AZLDBNJISNDM01: Connection established. AZLDBNJISNDM01: Sent key-exchange init (KEXINIT), waiting for response. AZLDBNJISNDM01: Using diffie-hellman-group-exchange-sha256 for key exchange AZLDBNJISNDM01: Host key algorithm: ssh-rsa AZLDBNJISNDM01: Algorithms, c->s: aes256-ctr hmac-sha2-512 none AZLDBNJISNDM01: Algorithms, s->c: aes256-ctr hmac-sha2-512 none AZLDBNJISNDM01: Entering Diffie-Hellman Group Exchange. AZLDBNJISNDM01: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<4096<8192) sent AZLDBNJISNDM01: Sent DH Group Exchange request, waiting for reply. AZLDBNJISNDM01: Received 2048 bit DH Group Exchange reply. AZLDBNJISNDM01: Generating new Diffie-Hellman keys. AZLDBNJISNDM01: Entering Diffie-Hellman key exchange. AZLDBNJISNDM01: Sent DH public key, waiting for reply. AZLDBNJISNDM01: Received host key, type 'ssh-rsa'. AZLDBNJISNDM01: Host 'XXXXXXXXX' is known and matches the host key. AZLDBNJISNDM01: Verifying server signature. AZLDBNJISNDM01: Send NEWKEYS. AZLDBNJISNDM01: Waiting for NEWKEYS message. AZLDBNJISNDM01: Enabling encryption/MAC/compression. AZLDBNJISNDM01: Sending request for user-authentication service. AZLDBNJISNDM01: Service accepted: ssh-userauth. AZLDBNJISNDM01: Trying empty user-authentication request. AZLDBNJISNDM01: Authentication methods that can continue: publickey,password. AZLDBNJISNDM01: Next method to try is publickey. AZLDBNJISNDM01: Trying pubkey authentication with key file 'keypath' AZLDBNJISNDM01: Login completed, opening dummy shell channel. AZLDBNJISNDM01: channel 0: new [client-session] AZLDBNJISNDM01: Requesting channel_open for channel 0. AZLDBNJISNDM01: channel 0: open confirm rwindow 300000 rmax 30000 AZLDBNJISNDM01: channel 1: new [client-session] AZLDBNJISNDM01: Requesting channel_open for channel 1. AZLDBNJISNDM01: Sending subsystem: sftp AZLDBNJISNDM01: Requesting service subsystem on channel 1. AZLDBNJISNDM01: channel 1: open confirm rwindow 300000 rmax 30000 AZLDBNJISNDM01: sftp: Sending SSH2_FXP_INIT AZLDBNJISNDM01: sftp: Remote version: 3 AZLDBNJISNDM01: sftp: Sent message T:11 I:0 AZLDBNJISNDM01: sftp: Sent message T:12 I:1 AZLDBNJISNDM01: sftp: Received reply T:104 I:1 AZLDBNJISNDM01: sftp: Received 67 SSH2_FXP_NAME responses drwxr-x--- 2 ftpadmin ftpadmin 0 Feb 04 08:37 . drwxr-x--- 2 ftpadmin ftpadmin 0 Jan 20 08:36 .. -rwxr-x--- 1 ftpadmin ftpadmin 1 Jan 30 01:52 --v -rwxr-x--- 1 ftpadmin ftpadmin 1 Feb 04 06:43 S1H62009.txt -rwxr-x--- 1 ftpadmin ftpadmin 1 Feb 04 06:37 S1H75009.txt -rwxr-x--- 1 ftpadmin ftpadmin 1 Jan 28 04:34 sftppath AZLDBNJISNDM01: sftp: Sent message T:12 I:2 AZLDBNJISNDM01: sftp: Received reply T:101 I:2 AZLDBNJISNDM01: sftp: Received SSH2_FXP_STATUS 1 AZLDBNJISNDM01: sftp: Sent message T:4 I:3 AZLDBNJISNDM01: sftp: Sent SSH2_FXP_OPEN I:4 P:helloabc.txt Couldn't get handle: Failure at trans.pl line 28. AZLDBNJISNDM01: sftp: Sent message T:17 I:5 AZLDBNJISNDM01: sftp: Received stat reply T:101 I:5 Couldn't stat remote file: Failure at trans.pl line 29.