Thank you zentara and salva for your answers.
Unfortunately, after messing with this all day, I wasn't able to get anything working from either one your posts. My thought now is to post the Net::SSH:Expect code that I've been using and I am trying to convert to Net::OpenSSH. Maybe this will help identify what I am trying to achieve, and the reasons behind it. So, here it is...
#!/usr/bin/perl use Net::SSH::Expect; my $ssh = Net::SSH::Expect->new ( host => "10.0.0.1", port => "22", user => "testuser", password => "testpassword", raw_pty => 1, timeout => '4', #log_file => "$TempLogFile" ); my $login_output = $ssh->login(); if ($login_output !~ /#/) { die "Login has failed. Login output was $login_output"; }; $ssh->exec("terminal width 512"); $ssh->exec("terminal length 0"); my @Output = $ssh->exec("sh run"); print "@Output\n"; $ssh->close();
Note that this code is using a username and password. If possible, I would rather use public key authentication.
Is this possible using the Net::OpenSSH Module (with maybe expect)? If so, how could I write it?
Thanks
In reply to Re: Net::OpenSSH multiple commands
by mlebel
in thread Net::OpenSSH multiple commands
by mlebel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |