Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: execute remote perl script via ssh

by haukex (Archbishop)
on Jul 26, 2020 at 09:58 UTC ( [id://11119826]=note: print w/replies, xml ) Need Help??


in reply to execute remote perl script via ssh

Have you looked at the values of $ssh_user, $hostname, and $user via e.g. Data::Dumper? Do you know whether ssh.exe is always in the PATH? Also, you should definitely be using a module to run external commands more safely, for example in this case I think IPC::Run3 might be appropriate (more info and sample code here). At the very least, use Win32::ShellQuote to build the command line.

Replies are listed 'Best First'.
Re^2: execute remote perl script via ssh
by vinoth.ree (Monsignor) on Jul 26, 2020 at 12:31 UTC
    Hi haukex

    I can see the value of $ssh_user, $hostname, and $user for the particular user

    I will try with IPC::Run3 instead of using qx().

    All is well. I learn by answering your questions...
      Hi Monks,

      I have identified the issue for that particular user, As I already said we use public key method to auto login without asking for the password, there is the problem, his user account is being shared by another user, so his private key is not secure and ssh fails with below error

      debug3: Bad permissions. Try removing permissions for user: XXXXX on f +ile C:\\Users\\XXXXXX/.ssh/id_rsa. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions for 'C:\\Users\\XXXXXX/.ssh/id_rsa' are too open. It is required that your private key files are NOT accessible by other +s. This private key will be ignored.

      After removing the permission for the other user, it works fine.


      All is well. I learn by answering your questions...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found