Loading ...
Sorry, an error occurred while loading the content.

Help needed with a Perl SFTP code: urgent !!!

Expand Messages
  • Hitarth
    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
    Message 1 of 5 , May 22, 2011
    View Source
    • 0 Attachment
      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 !!!
    • merlyn@stonehenge.com
      ... Hitarth I am supposed to write a perl code that uses SFTP to transfer Hitarth one file from my server to another server. Sounds a bit like homework. Can
      Message 2 of 5 , May 22, 2011
      View Source
      • 0 Attachment
        >>>>> "Hitarth" == Hitarth <hitarthmaru2006@...> writes:

        Hitarth> I am supposed to write a perl code that uses SFTP to transfer
        Hitarth> one file from my server to another server.

        Sounds a bit like homework. Can you prove it isn't?

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
        See http://methodsandmessages.posterous.com/ for Smalltalk discussion
      • Hitarth
        This is not Homework...I am working in a project where I am supposed to change an existing FTP connection to an SFTP, with perl.
        Message 3 of 5 , May 22, 2011
        View Source
        • 0 Attachment
          This is not Homework...I am working in a project where I am supposed to change an existing FTP connection to an SFTP, with perl.
        • Shawn H Corey
          ... Randal, you know it s impossible to prove a negative. Hitarth, don t let Randal get to you. I normally don t answer questions about modules I don t have
          Message 4 of 5 , May 22, 2011
          View Source
          • 0 Attachment
            On 11-05-22 04:10 AM, merlyn@... wrote:
            >>>>>> "Hitarth" == Hitarth<hitarthmaru2006@...> writes:
            >
            > Hitarth> I am supposed to write a perl code that uses SFTP to transfer
            > Hitarth> one file from my server to another server.
            >
            > Sounds a bit like homework. Can you prove it isn't?
            >

            Randal, you know it's impossible to prove a negative.

            Hitarth, don't let Randal get to you. I normally don't answer questions
            about modules I don't have any experience with but the Perl community
            has gotten a reputation for being unfriendly, so I thought I would give
            you a note of encouragement. The opinions of /some people/ don't
            necessarily reflect those of the community. Try to disregard them.

            And if you can't get an answer here, try perlmonks: http://perlmonks.org/


            --
            Just my 0.00000002 million dollars worth,
            Shawn

            Confusion is the first step of understanding.

            Programming is as much about organization and communication
            as it is about coding.

            The secret to great software: Fail early & often.

            Eliminate software piracy: use only FLOSS.
          • merlyn@stonehenge.com
            ... Shawn Randal, you know it s impossible to prove a negative. Sure he can. He can give a context that doesn t make it sound artificial. Which he almost
            Message 5 of 5 , May 22, 2011
            View Source
            • 0 Attachment
              >>>>> "Shawn" == Shawn H Corey <shawnhcorey@...> writes:

              >> Sounds a bit like homework. Can you prove it isn't?
              >>

              Shawn> Randal, you know it's impossible to prove a negative.

              Sure he can. He can give a context that doesn't make it sound
              artificial. Which he almost did.

              Shawn> Hitarth, don't let Randal get to you. I normally don't answer
              Shawn> questions about modules I don't have any experience with but the
              Shawn> Perl community has gotten a reputation for being unfriendly, so I
              Shawn> thought I would give you a note of encouragement. The opinions
              Shawn> of /some people/ don't necessarily reflect those of the
              Shawn> community. Try to disregard them.

              Shawn, don't help people cheat. If you have a better way of figuring
              out that something is homework besides just asking them respectfully,
              I'm all ears.

              --
              Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
              <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
              Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
              See http://methodsandmessages.posterous.com/ for Smalltalk discussion
            Your message has been successfully submitted and would be delivered to recipients shortly.