Hi,
I was trying to use Net::SSH::Perl to log into a remote box and execute a
program with pre-defined commands, something like:
#!/usr/bin/perl
use strict;
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new("ip", debug => 0);
$ssh->login("name", "password");
my ($return) = $ssh->cmd("minicom -S mini_script_vpn.force");
print $return;
minicom is a program, and mini_script_vpn.force is a script which defined a
set of commands sent to minicom
The terminal output should be something like: (if run the program manually
from shell)
minicom -S mini_script_vpn.force
minicom: WARNING: please don't run minicom as root when not maintaining
it (with the -s switch) since all changes to the
configuration will be GLOBAL !.
Welcome to minicom 1.83.1
OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
Compiled on May 3 2001, 22:36:07.
Press CTRL-A Z for help on special keys
Logging in..
c_fw>enable
Password:****
c_fw#Resetting VPN
configure terminal
c_fw(config)#Clear ipsec
clear crypto ipsec sa
c_fw(config)#Clear isakmp
clear crypto isakmp sa
c_fw(config)#Logging out and leaving...
Killed
But when I was running this command via the Perl Script above,
shell: RSA authentication failed: Can't load public key.
shell: Doing challenge response authentication.
shell: No challenge presented.
shell: Trying password authentication.
shell: Sending command: minicom -S mini_script_vpn.force
shell: Entering interactive session.
It quits immediately after sending command.
Any suggestion?
Thanks