Hi all, I am supposed to write a perl code that uses SFTP to transfer one file from my server to another server. The arguments are supposed to be read from a separate configuration file. The name of the config file is interface.cfg, and the name of the main perl file is interface.pl ---------- Configuration file format:

# Ftp to machine - interface hash_ref_Ftp_address= <server address> hash_ref_Ftp_user= <user_id> hash_ref_Ftp_passwd= <password>
...

(Currently I am using FTP...) Now I want to make this into an SFTP with RSA key(s) included. How should I add the argument? ---------- Perl file format: I am currently taking parameters like these-

{$ FTP_address}->{FTP_user}=<value>

Similarly I need to take keys as parameters from the configuration file. ---------- Execution: How would I create an SFTP connection and how would I log in? and How would I take keys as arguments? This are the commands I need to execute:

my $sftp = Net::SFTP->new($v_sftp_address, Debug => 1,..) $sftp->login($v_sftp_user, $v_sftp_passwd,..)

Do I only need to install Net::SFTP module for all this? I am a complete newbie so please help urgently !!!


In reply to Help required for SFTP code in Perl..urgent !!! by Hitarth1987

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.