Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Unable to do SCP on multiple machines using Perl's Net::SCP::Expect module

by salva (Abbot)
on May 03, 2014 at 19:51 UTC ( #1084899=note: print w/ replies, xml ) Need Help??

Comment on Re^3: Unable to do SCP on multiple machines using Perl's Net::SCP::Expect module
Download Code
Re^4: Unable to do SCP on multiple machines using Perl's Net::SCP::Expect module
by Technext (Acolyte) on May 05, 2014 at 10:14 UTC
    Thanks! I tried using Net::OpenSSH with key_path option.
    my $key_path = "/home/tom/.ssh/id_file"; my $ssh = Net::OpenSSH->new( $host, key_path => $key_path, ); $ssh->scp_put("$war_full_path", "$ENV{HOME}") or die "SCP failed: " . +$ssh->error;
    Now it fails with the message:
    Permission denied (publickey).
    SCP failed: unable to establish master SSH connection: master process exited unexpectedly at /home/tom/deploy.pl line 64

    Line 64 is the above line where i am using scp_put
      Are you able to log from the command line?
      ssh -vv -i "/home/tom/.ssh/id_file" hostname

        I'm really sorry for the blunder salva. I was not passing the user name while creating the connection. Now SSH is working fine on both the machines.

        After this worked, i realized the mistake that I was committing while using the earlier module (Net::SCP::Expect). Now the script is working with that module too. To simplify the explanation, in the first SCP, i needed to run the SCP as user A while in second SCP, which was on a different server, I needed a different user. However, in my script, I was using the same user A for performing SCP on both the machines and thatís why it wasnít working.

        Your pointer helped me in realizing the blunder I was committing. Thanks a lot! :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1084899]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2015-07-05 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls