in reply to Problems with Net::OpenSSH
Anyway, usually, the following hack works:
It just starts a remote shell, pipes the command through its stdin and captures the output.my $ssh = Net::OpenSSH->new("$username:$password\@$ip", timeout => 30) +; $ssh->error and die "unable to connect to remote host: ". $ssh->error; my $out = $ssh->capture({stdin_data => "show ip arp\n"});
If that doesn't work, you will have to revert to Expect. Running the following one-liner from the command line will allow you to interact with the remote shell as returned by open2pty so you can experiment with it and see what you should expect.
perl -MNet::OpenSSH -e 'Net::OpenSSH->new(q(USER:PASSWD@HOST))->system +({tty=>1})'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problems with Net::OpenSSH
by aeaton1843 (Acolyte) on Nov 23, 2010 at 16:05 UTC | |
by salva (Canon) on Nov 23, 2010 at 17:27 UTC |