Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by salva (Monsignor)
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 (Novice) 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 romping around the Monastery: (10)
As of 2014-09-19 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (132 votes), past polls