Using SSH and Expect to return STDOUT output from a C executable
This post if a followup to
It is a distinct topic, however, so I've started a new thread.
In the previous post, I managed to create a script that permanently
logged the output from a C executable that was always open. It used
the Expect module.
I would now like to do the same thing but remotely over SSH. For
security reasons, I am not allowed to go for the easy option of
exchanging unpassworded keys and using batch mode.
The script at the base of this email simply returns the following
output, without returning the output from 'ls':
bash-2.05# perl expectssh.pl
my $password = "password";
my $conn = Expect->spawn("ssh root\@10.247.16.2 ls") or die "Couldn't
if ($conn->expect(20,"Password: "))
print $conn "$password\n";
die "Never got username prompt on bla, ".$conn->exp_error()."\n";
|All times are GMT. The time now is 08:31 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.