For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2006 > Switching from FTP to SCP processing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Switching from FTP to SCP processing
Wagner, David --- Senior Programmer Analyst --- WG

2006-10-20, 6:56 pm

I found out this w that within our organization, FTP will be
no longer allowed and that in its place, scp ( secure copy over SSH )
will take it's place. I have a couple of polling modules which use FTP
to look for trigger files in specific locations on remote machines. I
then ftp the data from these machines onto my Perl machine, process the
files and generate internal emails. All this is handled by Perl.

From my understanding of scp, one has login rights to the remote
machine and you login and work from there. At this point, I am lost in
how one would handle what I am doing now using this new method of
processing.

Any suggestions and/or examples on how one attempt to accomplish
a task like this?

Thanks.

Wags ;)


****************************************
******************************
This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited.
****************************************
******************************


usenet@DavidFilmer.com

2006-10-20, 6:56 pm

IWagner, David --- Senior Programmer Analyst --- WGO wrote:
> I found out this w that within our organization, FTP will be
> no longer allowed and that in its place, scp ( secure copy over SSH )


I've rarely used scp (and never from a Perl program), but I use sftp
all the time (ftp over ssh), which should satisfy your org's
requirements. It does require that you be able to negotiate ssh
protocol 2 to do sftp, and the server must be running an sftp subsystem
within their sshd.conf configuration (many servers do this by default).

If you use Net::FTP in your existing scripts, you may find that
Net::SFTP is almost a drop-in replacement (depending on the complexity
of your application). If you just change your use() pragma your
existing script might work fine (because I gather your script is fairly
basic), or you might need to do just a bit of tweaking (for example, if
you set ASCII/binary mode, you won't need to do that in SFTP, so just
remove those calls).

You might also consider rsync over ssh.

--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)

usenet@DavidFilmer.com

2006-10-20, 6:56 pm

usenet@DavidFilmer.com wrote:

> I've rarely used scp (and never from a Perl program), but I use sftp
> all the time (ftp over ssh)


BTW, you should consult this message thread for some useful info:

http://tinyurl.com/jodv8

Basically, if you don't have a fast math library installed, your
performance will be horrible.

--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)

Ken Foskey

2006-10-21, 7:56 am

On Fri, 2006-10-20 at 10:56 -0700, Wagner, David --- Senior Programmer
>
> From my understanding of scp, one has login rights to the remote
> machine and you login and work from there. At this point, I am lost in
> how one would handle what I am doing now using this new method of
> processing.


ssh allows you to log in remotely. scp is secure copy, man scp it
replicates the cp command.

you might be interested in Net::SCP (http://search.cpan.org)

> Any suggestions and/or examples on how one attempt to accomplish
> a task like this?


If you want a more direct replacement of ftp then sftp might be closer
to what you want.

Net::SFTP is probably what you want.

YOU may want to investigate how to generate keys with ssh-keygen and
then installing it into the remote server in ~/.ssh/authorized_keys
(those Americans cannot spell...). Look this up on the web there are
hundreds of pages.

ssh and scp are miles ahead of ftp in scripting terms, I can use ftp
but it is horrible :-)

Thanks
Ken Foskey

Zentara

2006-10-21, 7:56 am

On Fri, 20 Oct 2006 10:56:58 -0700, David.Wagner@freight.fedex.com
("Wagner, David --- Senior Programmer Analyst --- WGO") wrote:

> I found out this w that within our organization, FTP will be
>no longer allowed and that in its place, scp ( secure copy over SSH )
>will take it's place. I have a couple of polling modules which use FTP
>to look for trigger files in specific locations on remote machines. I
>then ftp the data from these machines onto my Perl machine, process the
>files and generate internal emails. All this is handled by Perl.
>
> From my understanding of scp, one has login rights to the remote
>machine and you login and work from there. At this point, I am lost in
>how one would handle what I am doing now using this new method of
>processing.
>
> Any suggestions and/or examples on how one attempt to accomplish
>a task like this?


If you are using SSH2, try Net::SSH2.

It is a vast improvement over the old modules.

For a quick demo, see
http://perlmonks.org?node_id=569657



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com