CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Help required for SFTP code in Perl..urgent !!!

 



Hitarth1987
New User

May 22, 2011, 12:30 AM

Post #1 of 2 (3384 views)
Help required for SFTP code in Perl..urgent !!! Can't Post

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 !!!


miller
User

May 22, 2011, 11:41 AM

Post #2 of 2 (3355 views)
Re: [Hitarth1987] Help required for SFTP code in Perl..urgent !!! [In reply to] Can't Post

Yes, you must use cpan Net::SFTP, or a better option would probably be cpan Net::SSH2::SFTP

- Miller

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives