in reply to Re: Using SSH and SCP in a perl script with taint flag
in thread Using SSH and SCP in a perl script with taint flag
Hi Salva, thanks for your reply. I've read through the documentation for OpenSSH and it seems like a much better method than my current attempts. I'm getting really confused though with the examples in the documentation, and my own attempts aren't going well. Would you be able to help further? My current code sample is below.
#!/usr/bin/perl -wT use Net::OpenSSH; $ENV{PATH} = "/bin"; my $ssh = Net::OpenSSH->new("<IP>", user => "<username>", password => +"<password>"); $ssh->error and die "Can't ssh to host: " . $ssh->error; $ssh->system('whoami')or die "whoami failed: " .$ssh->error;
I should say, I have tried this without the password bit (as I use private key authentication) as well, and I have tried using syntax such as my $ssh = Net::OpenSSH->new("<user>\@<Host IP>");.
I get the following error:
Do you have any further advice?Can't exec "ssh": No such file or directory at /usr/share/perl5/Net/Op +enSSH.pm line 731. Can't ssh to host: unable to establish master SSH connection: master p +rocess exited unexpectedly
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Using SSH and SCP in a perl script with taint flag
by salva (Canon) on May 29, 2015 at 11:01 UTC | |
by stefl (Acolyte) on May 29, 2015 at 14:20 UTC | |
by stefl (Acolyte) on May 29, 2015 at 13:31 UTC | |
by salva (Canon) on May 29, 2015 at 13:54 UTC |