use strict; use warnings; use Net::SFTP::Foreign; my $host = '*mycompany*@*client_ftp_IP*'; my %args = ('ssh_cmd' => 'C:\Program Files\PuTTY\plink', ); my $sftp = Net::SFTP::Foreign->new( $host, %args, more => [ -P => '*connection port*', -i => 'G:\FTP\id_cmf_mediatechid_cmf_mediatech.ppk', -ssh, '-v', ] ); $sftp->error and die "Unable to stablish SFTP connection: " . sftp->error; $sftp->get("foo", "bar") or die "get failed: " . sftp->error; $sftp->put("bar", "baz") or die "put failed: " . sftp->error; #### Looking up host "*client_ftp_IP*" Connecting to *client_ftp_IP* port *connection port* Server version: SSH-2.0-OpenSSH_5.1 We claim version: SSH-2.0-PuTTY_Release_0.60 Using SSH protocol version 2 Doing Diffie-Hellman group exchange Doing Diffie-Hellman key exchange with hash SHA-256 Host key fingerprint is: ssh-rsa 2048 *FINGERPRINT KEY* Initialised AES-256 SDCTR client->server encryption Initialised HMAC-SHA1 client->server MAC algorithm Initialised AES-256 SDCTR server->client encryption Initialised HMAC-SHA1 server->client MAC algorithm Reading private key file "G:\FTP\id_cmf_mediatech\id_cmf_mediatech.ppk" Using username "mycompany". Offered public key Offer of public key accepted Authenticating with public key "rsa-key-20081029" Access granted Opened channel for session Server refused to start a shell/command FATAL ERROR: Server refused to start a shell/command Unable to stablish SFTP connection: Connection to remote server is broken at C:\PROGRA~1\OpenSSH\usr\sbin\test.pl line 24. ============================== #### use strict; use warnings; use Net::SFTP::Foreign; my $host = '*mycompany*@*client_ftp_IP*'; my %args = ('ssh_cmd' => 'C:\Program Files\OpenSSH\bin\ssh', ); my $sftp = Net::SFTP::Foreign->new( $host, %args, more => [ -p => '*connection port*', -i => 'C:\Documents and Settings\.ssh\id_cmf_mediatech', '-v', ] ); $sftp->error and die "Unable to stablish SFTP connection: " . $sftp->error; #### OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004 debug1: Reading configuration data /etc/ssh_config debug1: Connecting to *client_ftp_IP* [*client_ftp_IP*] port . debug1: Connection established. debug1: identity file C:\\Documents and Settings\\.ssh\\id_cmf_mediatech type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1 debug1: match: OpenSSH_5.1 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host '' is known and matches the RSA host key. debug1: Found key in /home/.ssh/known_hosts:1 debug1: ssh_rsa_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: publickey,gssapi-with-mic,password debug1: Next authentication method: publickey debug1: Trying private key: C:\\Documents and Settings\\.ssh\\id_cmf_mediatech debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: Sending subsystem: sftp Request for subsystem 'sftp' failed on channel 0 Unable to stablish SFTP connection: Connection to remote server is broken at C:\ PROGRA~1\OpenSSH\usr\sbin\test.pl line 23.