in reply to help to deal with ssh connection
You can execute commands on remote host using a Perl script using the Net::SSH::Perl module.
This module allows you to execute a command remotely and receive the STDOUT, STDERR, and exit status of that remote host command.
One big advantage of Net::SSH::Perl over other methods is that you can automate the login process, that way you can write fully automated perl scripts, no console interaction is required in order to authenticate in the remote machine.
#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; use Data::Dumper; my $Host = "xxxxxx"; my $User = "xxxxxx"; my $Secret = "xxxxxx"; my $Path="/home/ree"; #Connect my $ssh = Net::SSH::Perl->new($Host); $ssh->login($User, $Secret); # Execute the command my($stdout, $stderr, $exit) = $ssh->cmd("ls -l $Path");
But if you use Net::OpenSSH module, check useful info from this node Problems with Net::OpenSSH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: help to deal with ssh connection
by mitchreward (Acolyte) on May 18, 2014 at 22:52 UTC | |
by vinoth.ree (Monsignor) on May 19, 2014 at 04:43 UTC | |
by mitchreward (Acolyte) on May 19, 2014 at 05:51 UTC | |
by vinoth.ree (Monsignor) on May 19, 2014 at 08:48 UTC | |
by Anonymous Monk on May 19, 2014 at 10:04 UTC | |
| |
by Anonymous Monk on May 19, 2014 at 10:04 UTC |