So I want to connect to a SFTP server using a ppk file that is provided to me. I am able to establish the SFTP connection to this server using a client like FileZilla and using an utility like Pageant ( to upload the PPK file ). However I am not able to achieve this task of connecting to the server via Perl. Please find my code snippet below which I am using to establish the connection
use Net::SFTP; use Net::SSH::Perl::Auth; #!/usr/bin/perl $ENV{HOME} = "C:\\Perl\\myscripts\\etc"; my $host = 'test.secure01.batch.netgiro.com'; my %args = ( user => 'vistaprint_test', ssh_args => { identity_files => ["/home/ssh/id_rsa"], protocol=>'2,1', debug=>'true'} ); my $sftp = Net::SFTP->new($host, %args); print "connected!";
-------------------------------- SO for my ssh_args hash above, I am not sure what value should I include for the key 'Identity_files' I tried to point it to the PPK file which I have with me...but it did not help at all.... I get the following output
DEVPPAWAR: Reading configuration data C:\Perl\myscripts\etc/.ssh/confi +g DEVPPAWAR: Reading configuration data /etc/ssh_config DEVPPAWAR: Connecting to test.secure01.batch.netgiro.com, port 22. DEVPPAWAR: Remote protocol version 2.0, remote software version OpenSS +H_4.3 DEVPPAWAR: Net::SSH::Perl Version 1.34, protocol version 2.0. DEVPPAWAR: No compat match: OpenSSH_4.3. DEVPPAWAR: Connection established. DEVPPAWAR: Sent key-exchange init (KEXINIT), wait response. DEVPPAWAR: Algorithms, c->s: 3des-cbc hmac-sha1 none DEVPPAWAR: Algorithms, s->c: 3des-cbc hmac-sha1 none DEVPPAWAR: Entering Diffie-Hellman Group 1 key exchange. DEVPPAWAR: Sent DH public key, waiting for reply. DEVPPAWAR: Received host key, type 'ssh-dss'. DEVPPAWAR: Host 'test.secure01.batch.netgiro.com' is known and matches + the host key. DEVPPAWAR: Computing shared secret key. DEVPPAWAR: Verifying server signature. DEVPPAWAR: Waiting for NEWKEYS message. DEVPPAWAR: Send NEWKEYS. DEVPPAWAR: Enabling encryption/MAC/compression. DEVPPAWAR: Sending request for user-authentication service. DEVPPAWAR: Service accepted: ssh-userauth. DEVPPAWAR: Trying empty user-authentication request. DEVPPAWAR: Authentication methods that can continue: publickey,gssapi- +with-mic,p assword. DEVPPAWAR: Next method to try is publickey. DEVPPAWAR: Next method to try is password. DEVPPAWAR: Trying password authentication. DEVPPAWAR: Will not query passphrase in batch mode. DEVPPAWAR: Authentication methods that can continue: publickey,gssapi- +with-mic,password. . . . DEVPPAWAR: Next method to try is publickey. DEVPPAWAR: Next method to try is password. Permission denied at C:/strawberry/perl/site/lib/Net/SFTP.pm line 62
Any help on this would be highly appreciated....I am on a Windows machine . Please let me know if any more info is needed .... Thanks a lot for the help !!!

In reply to How to establish SFTP connection to a server using a ppk file by punitpawar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.