Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

copying directory from other machine to local machine

by ovedpo15 (Pilgrim)
on Mar 11, 2018 at 16:06 UTC ( [id://1210666]=perlquestion: print w/replies, xml ) Need Help??

ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to write a perl script which copies a directory with files from other machine to current machine.
I can use the scp command in shell but it requires a password.
Also I don't have the following modules insatlled on my work area (and unfortunately I cant install them):
Net::OpenSSH
Net::SSH::Perl
Net::SCP
Net:: FTP
I do have installed Net::SSH
My mission is to copy the files from other machine to current machine.
The main problem is that it requires a password to use scp on shell. Is there any elegant way to solve this problem?
  • Comment on copying directory from other machine to local machine

Replies are listed 'Best First'.
Re: copying directory from other machine to local machine
by marto (Cardinal) on Mar 11, 2018 at 16:18 UTC

    Depending on your needs you could configure your systems to use keys rather than prompt for passwords. Regarded perl modules see Yes, even you can use CPAN. cpanm & local::lib make this easy from a technical standpoint.

Re: copying directory from other machine to local machine
by karlgoethebier (Abbot) on Mar 11, 2018 at 17:16 UTC
    "...copies...files from other machine to current machine... elegant way..."

    I just remembered that rsync might be an option. See also File::Rsync and sshpass.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re: copying directory from other machine to local machine
by hilitai (Monk) on Mar 11, 2018 at 20:52 UTC

    Can you break this problem apart? Use perl to generate the list of files, then call scp to transfer the files? You should be able to get around the password prompts if you can set up passwordless ssh between the two machines.

Re: copying directory from other machine to local machine
by haukex (Archbishop) on Mar 11, 2018 at 19:12 UTC
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1210666]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-20 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found